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