#include #include #include int main() { int cons = 1000000007,a,b,k,c; long double count = 0; scanf("%d %d %d %d", &a, &b, &k, &c); long double help; if(a==b){ count = k; help = count; } else if (a==c || b==c){ count = pow(2,k-1)*k; help = fmodl(count,cons); } else{ count = 0; help = count; } printf("%.0Lf", help); return 0; }