#include <cstdio>
#define m 1000000007
int main()
{
	int n;
	long long sum;
	while(~scanf("%d",&n))
	{
		if(n==1)
			printf("1\n");
		else if(n==2)
			printf("2\n");
		else if(n==3)
			printf("4\n");
		else {
		sum=0;
		int f=n-1;
		int t=f-1;
		sum+=t*(t+1)/2;
		sum%=m;
		int q=t-1;
		int cnt;
		while(q!=1)
		{
			cnt=q;
			while(cnt)
			{
				sum+=cnt*(cnt+1)/2;
				sum%=m;
				cnt--;
			}
			q--;
		}
		sum=sum+n+1;
		sum%=m;
		printf("%lld\n",sum);}
	}
}