import java.io.*; class Main{ static final PrintWriter out=new PrintWriter(System.out); static long MOD=1000007; public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line=""; while((line=br.readLine())!=null&&!line.isEmpty()){ long n=Long.parseLong(line); long k=(long)n/2; n%=MOD; k%=MOD; long ans=n*(k+1); ans%=MOD; ans-=k*k; out.println(ans%MOD); out.flush(); } } }