class Fixnum
  alias old_div /
  def/(b)
    if (self>0 and b<0) or (self<0 and b>0)  then
      return self.fdiv(b).to_i
    else
      return self.old_div(b)
    end
  end
end

n= gets.chomp.to_i
0.upto(n-1){|i|
  s = gets.chomp.gsub(/=/,"")
  puts eval(s)
}