x,y=map(int,input().split()) ans=0 for i in range(1,y): if (x!=6 or x!=7): ans+=250 if(x==7): x=1 else: x+=1 print(ans-250)