import java.io.BufferedReader; import java.io.InputStreamReader; import java.math.BigInteger; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine()) - 1; br.close(); BigInteger bi1 = BigInteger.valueOf(n - 1); BigInteger bi2 = BigInteger.valueOf(n - 2); BigInteger bi3 = BigInteger.valueOf(2); BigInteger bi = bi1.multiply(bi2).divide(bi3); long ans = (n - 1) / 2; if (n % 3 == 0) { ans--; } BigInteger bi4 = BigInteger.valueOf(ans * 3); bi = bi.subtract(bi4); if (n % 3 == 0) { ans++; bi = bi.subtract(BigInteger.ONE); } ans %= 1000000007; bi = bi.divide(BigInteger.valueOf(6)); bi = bi.mod(BigInteger.valueOf(1000000007)); ans += bi.intValue(); ans %= 1000000007; System.out.println(ans); } }