l, r = map(int, input().split()) for i in range(l, r+1): j = str(i) s = 0 for x in j: x = int(x) ** 4 s = s + x if s == i: print(i,end=' ')