import java.util.*; import java.io.*; public class Main{ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long ans = 0; int k = 1; int kv = 1; while(k <= n){ if(kv == 4) kv = 1; ans += (long)Math.pow(k,kv); k++; kv++; } System.out.println(ans); } }