#include<bits/stdc++.h> using namespace std; int x,n,s=0; int main(){ cin>>x>>n; for(int i=x;s<n;i++){ if(i!=6&&i!=7){ s++; } if(i==7){ i=1; } } cout<<s*250<<endl; return 0; }