#!/usr/bin/env python
# -*- coding: utf-8 -*-
n = int(input())

mod = 1000007;
print((n * n // 4 + n) % mod);