import math, cmath mod107 = 1000000007; mod998 = 998244353; alphabet = 'abcdefghijklmnopqrstuvwxyz' def pyth(a, b, c, d): l = ((a - c) ** 2 + (b - d) ** 2) ** 0.5 return l #------------------------- n = int(input()) ans = 0 for i in range(n): ans += (i + 1) ** (i % 3 + 1) print(ans)