#include <bits/stdc++.h>
using namespace std;
map<int, int> q;
int main() {
  int b, c;
  scanf("%d %d", &b, &c);
  long long ans = 0;
  int r = sqrt(c), t, f, xa, sh, z;
  r = min(r, b);
  for (int i = 1; i <= r; ++i) {
    t = sqrt((long long)i * i - 1);
    ans += (i * i - t - 1) * 2;
  }
  for (int i = r + 1; i <= b; ++i) {
    xa = sqrt((long long)i * i - c - 1), sh = sqrt((long long)i * i - 1);
    if (sh - xa == 0) {
      ans += (long long)c * 2 * (b - i + 1);
      break;
    } else {
      ans += (c + xa - sh) * 2;
    }
  }
  int tt = 0;
  if (b * 2 >= c) {
    tt = c * 3.0 / 4;
    if (c % 4 == 1) tt += 1;
  } else if (b * 4 >= c) {
    tt = b * 2 * 3.0 / 4 + 0.3;
    c -= 2 * b;
    tt += c / 4;
  } else {
    tt = b + b - 1;
  }
  printf("%I64d\n", ans + tt);
}
