var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function(chunk) {
    input += chunk;
});

process.stdin.on('end', function() {
    main(input.split('\n'));
});

function main(input) {
    var n = +input[0];
    for(var i = 0; i < n; ++i) console.log(eval(input[i+1].slice(0,-1))|0);
}