mins = 0 l,r,c = map(int,input().split()) sc = float(inf) for i in range(r-l+1): sc = min(((l+i)*c)%1000,sc)