#include #include #include using namespace std; int main() { int a, b, c, k; long long int result = 0; cin >> a >> b >> k >> c; if ( c != a && c != b ) { cout << 0 << endl; return 0; } if ( a == b ) { cout << k << endl; return 0; } if ( k != 1 ) result += k * 2; else result += 1; long long int tmp_result; for (int i = 2; i < k; i++) { tmp_result = 1; for ( int braces = 0 ; braces < i ; braces++ ) tmp_result *= k - braces; tmp_result = ( tmp_result / 2 ) * i; result += tmp_result; //cout << tmp_result << ", " << result << endl; } cout << result % 1000000007 << endl; return 0; }