#include <iostream>

using namespace std;

void tinhtoan(long long a, long long b, char c) {
    if (c == '+') {
        cout << a + b << "\n";
    } else if (c == '-') {
        cout << a - b << "\n";
    } else if (c == '*') {
        cout << a * b << "\n";
    } else if (c == '/') {
        if (b == 0) {
            cout << -1 << "\n";
        } else {
            cout << a / b << "\n";
        }
    } else if (c == '%') {
        if (b == 0) {
            cout << -1 << "\n";
        } else {
            cout << a % b << "\n";
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int T;
    if (cin >> T) {
        while (T--) {
            long long a, b;
            char c;
            cin >> a >> b >> c;
            tinhtoan(a, b, c);
        }
    }

    return 0;
}