#include <iostream>
#include <cmath>
using namespace std;
int main() {
int m1 , m2 , m3 , x;
cin >> m1 >> m2 >> m3;
if ( ( m1 + m2 + m3 ) % 3 == 0 ) {
if ( m1 != m2 and m1 != m3 and m2 != m3 ) {
cout << ( max ( max ( m1 , m2 ) , m3 ) - ( ( m1 + m2 + m3 ) / 3 ) );
}
else if ( m1 == m2 ) {
int x;
x = ( m3 - ( m1 + m2 + m3 ) / 3 );
if ( x < 0 ) {
cout << -x;
}
else cout<<x;
}
else if ( m1 == m3 ) {
int x;
x = ( m2 - ( m1 + m2 + m3 ) / 3 );
if ( x < 0 ) {
cout << -x;
} else cout << x;
}
else if ( m2 == m3 ) {
int x;
x = ( m1 - ( m1 + m2 + m3 ) / 3 );
if ( x < 0 ) {
cout << -x;
}
else cout << x;
}
}
else cout << "IMPOSSIBLE";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCBtMSAsIG0yICwgbTMgLCB4OwoJY2luID4+IG0xID4+IG0yID4+IG0zOwoJaWYgKCAoIG0xICsgbTIgKyBtMyApICUgMyA9PSAwICkgewoJCWlmICggbTEgIT0gbTIgYW5kIG0xICE9IG0zIGFuZCBtMiAhPSBtMyApIHsKCQkJY291dCA8PCAoIG1heCAoIG1heCAoIG0xICwgbTIgKSAsIG0zICkgLSAoICggbTEgKyBtMiArIG0zICkgLyAzICkgKTsKCQl9CgkJZWxzZSBpZiAoIG0xID09IG0yICkgeyAKCQkJaW50IHg7CgkJCXggPSAoIG0zIC0gKCBtMSArIG0yICsgbTMgKSAvIDMgKTsKCQkJaWYgKCB4IDwgMCApIHsgCgkJCQljb3V0IDw8IC14OyAKCQkJfSAKCQkJZWxzZSBjb3V0PDx4OwoJCX0KCQllbHNlIGlmICggbTEgPT0gbTMgKSB7IAoJCQlpbnQgeDsKCQkJeCA9ICggbTIgLSAoIG0xICsgbTIgKyBtMyApIC8gMyApOwoJCQlpZiAoIHggPCAwICkgeyAKCQkJCWNvdXQgPDwgLXg7CgkJCX0gZWxzZSBjb3V0IDw8IHg7CgkJfQoJCWVsc2UgaWYgKCBtMiA9PSBtMyApIHsgCgkJCWludCB4OwoJCQl4ID0gKCBtMSAtICggbTEgKyBtMiArIG0zICkgLyAzICk7CgkJCWlmICggeCA8IDAgKSB7IAoJCQkJY291dCA8PCAteDsgCgkJCX0gCgkJCWVsc2UgY291dCA8PCB4OwoJCQl9CgkJfQoJZWxzZSBjb3V0IDw8ICJJTVBPU1NJQkxFIjsKCXJldHVybiAwOwp9