n, m = gets.split op, *B = gets.split A = (0..n).map{gets} for i in 0..n print(eval(A[i] + op + b)) end