import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); long n = koko.nextLong(); 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 b = n*a; b=b%1000007; long c = a*a; c=c%1000007; long ans = (b-c+n); System.out.println((long)ans); } } }