n,k = map(int,input().split()) if n % (1+k) ==1: print(1000) else: print(0)