#include <bits/stdc++.h> using namespace std; int main() { long x, n; cin >> x >> n; long res = 0; for (int i = 0; i < n; ++i) { if (x % 6 == 0 || x % 7 == 0) res = res; else res += 250; if (x % 7 == 0) x = 0; x++; } cout << res; }