n = int(input()) print(sum(map(int, str(7 ** n))))