#include <iostream> using namespace std; void add(int a, int b) { cout << a + b << endl; } void sub(int a, int b) { cout << a - b << endl; } void mul(int a, int b) { cout << a* b << endl; } void divide(int a, int b) { if (b == 0) cout << "error" << endl; else cout << a / b << endl; } void fac(int a) { long long res = 1; while (a >= 1) { res *= a--; } cout << res << endl; } void rem(int a, int b) { if (b == 0) cout << "error" << endl; else cout << a % b << endl; } int main() { int n1, n2; char op; while (cin >> n1 >> op) { if (op != '!') cin >> n2; switch (op) { case '+': add(n1, n2); break; case '-': sub(n1, n2); break; case '*': mul(n1, n2); break; case '/': divide(n1, n2); break; case '!': fac(n1); break; case '%': rem(n1, n2); break; } } }