import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); long n = koko.nextInt(); if(n%2==0){ long t = (n/2)%1000007; long a = (t*t+n)%1000007; System.out.println(a); }else{ long a = ((n+1)/2)%1000007; n = n%1000007; long ans = (n*a-a*a+n)%1000007; System.out.println(ans); } } }