import java.io.*; import java.math.BigInteger; 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; BigInteger x=BigInteger.valueOf(n*(k+1)); BigInteger y=BigInteger.valueOf(k*k); BigInteger mod=BigInteger.valueOf(MOD); x=x.subtract(y).remainder(mod); out.println(x); out.flush(); } } }