s=[];$_.to_i.times{s<<(gets=~/[^0-9\n]/?"Invalid input":($_.to_i-2)*180)}while gets;puts s*$/