k=int(input()) l=int(input()) r=int(input()) s=0 for i in range(l,r+1): if i%10==k: s+=i elif i%k==0: s+=i print(s)