r=io.read while""do x=r"*n"print(180-(x-r()+540)%360)end