num = input() digits = list(map(int, list(num))) ans = 1 if all(d%4 == 0 for d in digits): ans *= 4 elif all(d%2 == 0 for d in digits): ans *= 2 if sum(digits)%9 == 0: ans *= 9 elif sum(digits)%3 == 0: ans *= 3 if all(d%5 == 0 for d in digits): ans *= 5 if len(set(digits)) == 1: print(num) else: print(ans)