#include int main() { char* str = new char[100]; fgets(str, 100, stdin); int a1 = 0, a2 = 0, h1 = 1, h2 = 1; if (str[0] == '-') { h1 = -1; ++str; } while(*str >= '0' && *str <= '9'){ a1 = 10 * a1 + (*str - '0'); ++str; } if (*str == '+') { h2 *= -1; } ++str; if (*str == '-') { h2 *= -1; ++str; } while (*str >= '0' && *str <= '9') { a2 = 10 * a2 + (*str - '0'); ++str; } printf("%d\n", h1*a1 + h2*a2); }