#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);
}
bool checkIsValidString(string str) {
for (int i = 0; i < str.size(); i++) {
if (!isdigit(str[i])) {
return false;
}
}
return true;
}
int myAtoi (string str) {
if (!str.size()) return 0;
bool hasNegativeSymbol = str[0] == '-';
bool hasPositiveSymbol = str[0] == '+';
string s = (hasNegativeSymbol || hasPositiveSymbol) ? str.substr(1) : str;
s = trimLeft(s);
bool isValidInput = checkIsValidString(s);
if (!isValidInput) return 0;
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+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpzdHJpbmcgdHJpbUxlZnQoc3RyaW5nIHN0cikgewoJaWYgKCFzdHIuc2l6ZSgpKSByZXR1cm4gIiI7CglpbnQgaSA9IDA7Cgl3aGlsZSAoc3RyW2ldID09ICcgJyB8fCBzdHJbaV0gPT0gJzAnKSB7CgkJaSsrOwoJfQoJCglyZXR1cm4gc3RyLnN1YnN0cihpKTsKfQoKCmJvb2wgY2hlY2tJc1ZhbGlkU3RyaW5nKHN0cmluZyBzdHIpIHsKCWZvciAoaW50IGkgPSAwOyBpIDwgc3RyLnNpemUoKTsgaSsrKSB7CgkJaWYgKCFpc2RpZ2l0KHN0cltpXSkpIHsKCQkJcmV0dXJuIGZhbHNlOwoJCX0KCX0KCQoJcmV0dXJuIHRydWU7Cn0KCmludCBteUF0b2kgKHN0cmluZyBzdHIpIHsKCWlmICghc3RyLnNpemUoKSkgcmV0dXJuIDA7CgkKCWJvb2wgaGFzTmVnYXRpdmVTeW1ib2wgPSBzdHJbMF0gPT0g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