M=1000007 N=int(input()) N%=M N2=N*N N2%=M if N%2==1: N2-=1 N2//=4 N2+=N N2%=M print (N2)