luogu#P4936. Agent1

Agent1

Background

On November 17, 2018, Hong Kong, China will host an XM war, where ENLIGHTENED and RESISTANCE from all over the world will fight. An ENLIGHTENED headquarters in some place also wants to send Agents to join this XM war, fighting side by side with ENLIGHTENED from other places.

Problem Description

An ENLIGHTENED headquarters in some place has NN Agents, and each Agent has a different ability value. Now the ENLIGHTENED operation commander wants to send two teams of Agents, Team AA and Team BB, to take part in the XM war. However, the two teams must satisfy two requirements:

  1. The ability value of the strongest Agent in Team AA must be less than the ability value of the weakest Agent in Team BB.
  2. Both Team AA and Team BB must have at least one person.

Not all Agents must go to the XM war. The impatient ENLIGHTENED operation commander wants to know how many different ways there are to arrange Agents to join the war. Since the answer may be very large, you only need to output the value of the answer modulo (109+7)(10^9+7).

Input Format

The input contains only one line, an integer NN.

Output Format

Output the answer modulo (109+7)(10^9+7).

3
5
6
129

Hint

For 20%20\% of the testdata, N10N \leq 10.

For 40%40\% of the testdata, N103N \leq 10^3.

For 60%60\% of the testdata, N105N \leq 10^5.

For 100%100\% of the testdata, N109N \leq 10^9.

Translated by ChatGPT 5