#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5005;
const long long MOD = 1000000007ll;
int N, A, B, K;
long long cache[MAX_N][MAX_N];
long long cumul[MAX_N];
int main() {
  scanf("%d %d %d %d", &N, &A, &B, &K);
  A--;
  B--;
  for (int i = 0; i < N; i++) {
    if (i != B) {
      cache[0][i] = 1ll;
    }
    cumul[i + 1] = cumul[i] + cache[0][i];
    ;
  }
  for (int i = 1; i <= K; i++) {
    for (int f = 0; f < N; f++) {
      if (f == B) {
        cache[i][f] = 0ll;
      } else {
        int d = abs(f - B);
        int lo = max(0, f - (d - 1));
        int hi = min(N, f + d);
        cache[i][f] =
            ((cumul[hi] - cumul[lo] - cache[i - 1][f]) % MOD + MOD) % MOD;
        ;
      };
    }
    cumul[0] = 0ll;
    for (int f = 0; f < N; f++) {
      cumul[f + 1] = (cumul[f] + cache[i][f]) % MOD;
    }
  }
  printf("%lld\n", cache[K][A]);
  return 0;
}
