#include<bits/stdc++.h> using namespace std; int main() { long long x , n , sum = 0; cin >> x >> n; while (n > 0) { if(x == 6) { x += 2; x -= 7; n -= 2; } if(x == 7) { x = 1; n -= 1; } n -= 1; x++; sum += 250; } cout << sum << endl; }