import math X,Y = map(int,input().split()) counterlist = [] for i in range(X,Y+1): counter = 0 for k in range(math.floor((i/2)**0.5),math.ceil(i**0.5)): if (i-k**2)**0.5-math.floor((i-k**2)**0.5)==0.0: if k-(i/2)**0.5 == 0.0 or k == 0: counter +=0.5 else: counter += 1 else: pass counterlist.append(counter) a = int(max(counterlist))*8 print(a)