#include #define ll long long int using namespace std; int main() { ll a, b, k, c; cin >> a >> b >> k >> c; if (c != a && c != b) { cout << "0\n"; return 0; } if (a == b) { cout << k << "\n"; return 0; } ll prod = k; for (int i = 0; i < k - 1; i++) { prod *= 2; prod %= 1000000007; } cout << prod << "\n"; return 0; }