#include <bits/stdc++.h>
#define reopen(A) { freopen(#A".in", "r", stdin); freopen(#A".out", "w", stdout); }
#define F(i, l, r) for(int i = l; i < r; ++i)
#define Fe(i, l, r) for(int i = l; i <= r; ++i)
#define Fer(i, l, r) for(int i = l; i >= r; --i)
#define debug(a) cout<< #a": " << a <<endl;
#define endl '\n'
using namespace std;
typedef long long ll;
constexpr int mod = 1e9 + 7;
int n, m;

signed main(){
	reopen(barrack);
	ios::sync_with_stdio(0); cin.tie(0);
	cin>> n >> m;
	ll ans = 2, t = 0;
	F(i, 1, n){
		t = t + 3;
		t %= mod;
		ans += t;
		ans %= mod;
	}
	cout<<ans<<endl;
	
	return 0;
}
