#include using namespace std; int main() { int n; cin >> n; constexpr int M = 1000000007; cout << 333333336LL * n % M * (n + 1) % M << '\n'; }