x, y = map(int, input().split()) i = 1 squ = [] while i * i <= y: squ.append(i * i) i += 1 cnt = {} l = len(squ) ans = 0 for s in [0] + squ: for q in squ: if x <= s + q <= y: cnt[s + q] = cnt.get(s + q, 0) + 1 ans = max(ans, cnt[s + q]) print(4 * ans)