#include <bits/stdc++.h>
using namespace std;
string trimLeft(string str) {
if (!str.size()) return "";
int i = 0;
while (str[i] == ' ' || str[i] == '0') {
i++;
}
return str.substr(i);
}
int getFirstInvalidIndex(string str) {
if (!str.size()) return 0;
int index = 0;
while (isdigit(str[index])) {
index++;
}
return index;
}
int myAtoi (string str) {
if (!str.size()) return 0;
str = trimLeft(str);
bool hasNegativeSymbol = str[0] == '-';
bool hasPositiveSymbol = str[0] == '+';
string s = (hasNegativeSymbol || hasPositiveSymbol) ? str.substr(1) : str;
int firstInvalidIndex = getFirstInvalidIndex(s);
if (firstInvalidIndex == s.size() && !isdigit(s[s.size() - 1])) return 0;
s = s.substr(0, firstInvalidIndex);
int size = s.size(), result = 0, currentPower = 0;
for (int i = size - 1; i >= 0; i--) {
int currentNumber = s[i] - '0';
result = result + (currentNumber * pow(10, currentPower++));
}
return hasNegativeSymbol ? -result : result;
}
int main() {
string s;
while (cin >> s) {
cout << myAtoi(s) << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJpbmcgdHJpbUxlZnQoc3RyaW5nIHN0cikgewoJaWYgKCFzdHIuc2l6ZSgpKSByZXR1cm4gIiI7CglpbnQgaSA9IDA7Cgl3aGlsZSAoc3RyW2ldID09ICcgJyB8fCBzdHJbaV0gPT0gJzAnKSB7CgkJaSsrOwoJfQoJCglyZXR1cm4gc3RyLnN1YnN0cihpKTsKfQoKCmludCBnZXRGaXJzdEludmFsaWRJbmRleChzdHJpbmcgc3RyKSB7CglpZiAoIXN0ci5zaXplKCkpIHJldHVybiAwOwoJaW50IGluZGV4ID0gMDsKCQoJd2hpbGUgKGlzZGlnaXQoc3RyW2luZGV4XSkpIHsKCQlpbmRleCsrOwoJfQoJCglyZXR1cm4gaW5kZXg7Cn0KCmludCBteUF0b2kgKHN0cmluZyBzdHIpIHsKCWlmICghc3RyLnNpemUoKSkgcmV0dXJuIDA7CgkKCXN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