#include #include using namespace std; int myPow(int x, int n) { int out=1; for(int i = 0; i < n; i++) { out=out*x; out=out%1000000007; } return out; } int main() { int a,b,k,c, out = 0; cin>>a>>b>>k>>c; if (a==b && a==c) out=k; else if(a==c || b==c) { out = (myPow(2, k-1)*k); } cout<