#include #include #include long long factorial(int k, int i) { long long result = 1; if (i < k - i) i = k - i; for (int j = k; j > i; j--) { result *= j; } for (int j = k - i; j > 0; j--) { result /= j; } return result; } using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int a, b, k, c; cin >> a >> b >> k >> c; if (c == a && c == b) { cout << k << '\n'; return 0; } if (c != a && c != b) { cout << 0 << '\n'; return 0; } long long result = 0; for (int i = 0; i <= k; i++) { result += i * factorial(k, i); } result = result % 1000000007; cout << result << '\n'; return 0; }