#include<iostream>
using namespace std;
long long n, k, sum;
int main() {
cin >> n >> k;
for (int i = 2; i <= 6; i++) {
long long S = 0;
for (int j = 2; j <= n - 1; j++) {
long long P = j * 7 + i - 7; P *= 9;
if (P % 11 == k) { S = j; break; }
}
if (S == 0)continue;
sum += ((n - 1) - S) / 11 + 1;
}
cout << sum << endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmxvbmcgbG9uZyBuLCBrLCBzdW07CmludCBtYWluKCkgewoJY2luID4+IG4gPj4gazsKCWZvciAoaW50IGkgPSAyOyBpIDw9IDY7IGkrKykgewoJCWxvbmcgbG9uZyBTID0gMDsKCQlmb3IgKGludCBqID0gMjsgaiA8PSBuIC0gMTsgaisrKSB7CgkJCWxvbmcgbG9uZyBQID0gaiAqIDcgKyBpIC0gNzsgUCAqPSA5OwoJCQlpZiAoUCAlIDExID09IGspIHsgUyA9IGo7IGJyZWFrOyB9CgkJfQoJCWlmIChTID09IDApY29udGludWU7CgkJc3VtICs9ICgobiAtIDEpIC0gUykgLyAxMSArIDE7Cgl9Cgljb3V0IDw8IHN1bSA8PCBlbmRsOwoJcmV0dXJuIDA7Cn0=