a=input ().split () a=a[1::] b=1000 for i in a : b*(1000-int(a))/1000 print (1000-b)