x,n=map(int,input().split()) t=0 c=x for i in range(n): if c not in (6,7): t+=250 c+=1 if c>7: c=1 print(t)