#include<bits/stdc++.h> using namespace std; int main() { int n,x; cin>>n>>x; cout<<(max(6-n,0)+(x-max(6-n,0))/7*5+(x-max(6-n,0))%7)*250; return 0; }