x,n=map(int,input().split()) if 1 <= x <= 5: print(250*(n-((n+x-1)//7)*2)) else: print(250*(n-((n+x-1)//7+(8-x))*2))