import numpy as np U = 10 ** 7 r = np.arange(int(U ** 0.5) + 1, dtype=np.int32) r = r * r d = np.add.outer(r[r > 0], r).flatten() cnt = np.bincount(d) X, Y = map(int, input().split()) ans = cnt[X:Y + 1].max() print(4 * ans)