import java.util.Scanner; public class Main{ static Scanner s=new Scanner(System.in); public static void main(String __[]){ input(); solve(s.nextInt()); } private static void input(){ } static int mod=1000000007; private static void solve(long in){ long buf=in*in; buf%=mod; buf*=in; buf%=mod; System.out.println(buf); } }