#include <iostream> using namespace std; int a,b,c=0; int main(){ cin>>a>>b; while(b>0){ a%=7; if(a<=5){ c+=250; } a++; b--; } cout<<c; }