import java.io.*; import java.util.*; import java.math.*; class Main { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BigInteger n = new BigInteger(br.readLine()); BigInteger zero = BigInteger.ZERO; BigInteger one = BigInteger.ONE; BigInteger two = BigInteger.valueOf(2); BigInteger mod = BigInteger.valueOf(1000007); if (n.remainder(two).compareTo(zero) == 0) { jout(n.divide(two).add(one).pow(2).subtract(one).mod(mod) + "\n"); } else { jout(n.add(one).divide(two).add(one).multiply(n.subtract(one).divide(two).add(one)).subtract(one).mod(mod) + "\n"); } } public static void jout (Object o) { System.out.print(o); } }