#include<iostream>
#include<algorithm>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int x,n;
long long s=0,t;
cin>>x>>n;
if(x+n<6)s=n*250;
else if(x+n==6)s=(n-1)*250;
else if(x+n>=7){
t=(x+n)/7;
s=t*5*250-x*250+(x+n-7*t)*250;
}
cout<<s;
return 0;
}