def Eratosthenes(N): #N以下の素数のリストを返す #iが素数のときis_prime_list[i]=1,それ以外は0 N+=1 is_prime_list = [True]*N m = int(N**0.5)+1 for i in range(3,m,2): if is_prime_list[i]: is_prime_list[i*i::2*i]=[False]*((N-i*i-1)//(2*i)+1) return [2] + [i for i in range(3,N,2) if is_prime_list[i]] n = 10**7 r = [1]*(n+1) r[0] = 0 for p in Eratosthenes(n): if p==2: continue for i in range(p,n+1,p): j = i//p c = 1 while j%p==0: j //= p c += 1 if p%4==1: r[i] *= c+1 else: if c%2: r[i] = 0 x,y = map(int,input().split()) print(max(r[x:y+1])*4)