#include<bits/stdc++.h> using namespace std; int main() { long long x,n; cin>>x>>n; if(x+n<7) cout<<250*n; else cout<<250*(n-((x+n)/7*2)); return 0; }