https://www.luogu.com.cn/problem/P1424
""" P1424 小鱼的航程(改进版) https://www.luogu.com.cn/problem/P1424 """ ans=0 x,n=map(int,input().split()) for i in range(n): if x!=6 and x!=7: ans+=250 if x==7: x=1 else: x+=1 print(ans)