import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long N = scan.nextLong(); scan.close(); int a = 1000007; N = N % a; long x; if(N % 2 == 0) { x = N / 2; }else { x = N / 2 + 1; } long ans = (long)(x + 1) * (N - x + 1) - 1; ans = ans % a; System.out.println(ans); } }