We need to compute product of i from i=1 to N modulo MOD=1e9+7. N up to 1e5. That's straightforward: compute factorial(N) mod MOD. For N=1e5, it's trivial.
But there might be a catch? The problem states: "Snuke loves working out. He is now exercising N times. Before he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i." So essentially power = 1 * 1 * 2 * 3 * ... * N? Actually careful: after first exercise (i=1), multiply by 1 => power becomes 11=1. After second (i=2), multiply by 2 => 12=2. After third (i=3), multiply by 3 => 2*3=6. So indeed power after N exercises = N! (factorial). So answer is N! mod MOD.
N up to 1e5, that's fine.
Just compute factorial iteratively.
But wait: could N be larger? It says up to 1e5. So simple.
Now the examples: 3 -> 6, 10 -> 3628800 (which is 10! = 3628800). 100000 output given 457992974; we can check? But okay.
Implementation: read N, initialize ans = 1, loop i=1..N, ans = ans * i % MOD, print ans.
Edge case: N=0? Not given, N>=1.
So answer is trivial.
But maybe there is a twist: Could be that i is the index of exercise, but maybe exercises are done in some order? No, it says "after he exercises for the i-th time, his power gets multiplied by i." So it's sequential.
Thus solution: compute factorial modulo MOD.
Given the simplicity, perhaps there is a catch: N might be up to 10^7? But constraints say 1e5. So fine.
Thus code: in C++:
#include
using namespace std;
const int MOD = 1e9+7;
int main() {
int N; cin >> N;
long long ans = 1;
for (int i=2; i<=N; ++i) ans = (ans * i) % MOD;
cout << ans << endl;
return 0;
}
Make sure to use long long to avoid overflow. MOD fits in int, but multiplication of two ints may overflow int, so use long long.
In Python, even simpler: just compute factorial using loop and modulo.
Thus answer.
But the instruction: "You are an AI programming agent. Provide the final answer as a code block with the complete solution." So I'll output a Python solution, but can also output C++. Usually they accept any language? The problem statement is from AtCoder? Actually it's a typical AtCoder problem "ABC 042 B"? Not exactly. But we can provide Python.
We'll produce a simple solution.
But also ensure to handle input correctly.
Now final answer: Provide code.
Also could compute using math.factorial but mod needed; better to compute iteratively.
So final answer: In Python:
import sys
MOD = 10**9+7
def solve():
N = int(sys.stdin.readline())
ans = 1
for i in range(2, N+1):
ans = (ans * i) % MOD
print(ans)
if __name__ == "__main__":
solve()
Add main guard.
Alternatively, one-liner: print(math.factorial(N) % MOD), but math.factorial for N=100000 is huge but Python can handle big ints, but might be slower, but still fine? But modulo after factorial might be slower because factorial is huge. Better to compute mod in loop.
Thus answer.
But I should adhere to the requirement: "Provide the final answer as a code block with the complete solution." So I'll give a full program.
Thus answer: Python code.
Maybe they expect C++? But any language is fine. I'll choose Python.
Now produce final message. ```python
import sys
MOD = 10**9 + 7
def solve() -> None:
N = int(sys.stdin.readline())
ans = 1
for i in range(2, N + 1):
ans = (ans * i) % MOD
print(ans)
if name == "main":
solve()