#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, x = 0, y = 0, z = 0;
  int a[] = {4, 9, 3, 8, 2, 7, 1, 6, 5, 0};
  cin >> n >> m;
  x = m / 10;
  if (x > 0) {
    y = m % 10;
    z += x * 2 * n;
    for (long long i = 0; i < 2 * n; i++) {
      if (a[i % 10] <= y && a[i % 10] != 0) z++;
    }
    cout << z;
  } else {
    for (long long i = 0; i < 2 * n; i++) {
      if (a[i % 10] <= m && a[i % 10] != 0) z++;
    }
    cout << z;
  }
}
