#include<bits/stdc++.h> using namespace std; int main(){ int x,n,a,b,weekend,time; cin>>x>>n; if(x==7){ a=((x+n)/7)-1; } else{ a=((x+n)/7); } b=((x+n)/8); weekend=a+b; time=(n-weekend)*250; cout<<time; return 0; }