#include <bits/stdc++.h> #define ll long long #define int ll using namespace std; const int N = 1010, mod = 10007; int dp[2][N][N], k; int a, b, n, m; signed main() { cin >> a >> b >> k >> n >> m; k -- ; dp[0][1][0] = a, dp[0][0][1] = b; for(int mark ...