#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAXS = 5010;
int N, K, A, B;
int first[MAXS], last[MAXS];
long long DP[2][MAXS];
long long S[MAXS];
int main() {
  scanf("%d %d %d %d", &N, &A, &B, &K);
  for (int i = 1; i <= N; i++) {
    first[i] = last[i] = 0;
    if (i == B) continue;
    for (int j = 1; j <= N; j++) {
      if (abs(i - j) < abs(B - j)) {
        first[i] = j;
        last[i] = j;
        while (abs(i - last[i] - 1) < abs(B - last[i] - 1) and last[i] < N)
          last[i]++;
        break;
      }
    }
    DP[0][i] = DP[1][i] = 0;
  }
  DP[0][A] = 1;
  for (int k = 0; k < K; k++) {
    S[0] = 0;
    for (int i = 1; i <= N; i++) {
      DP[1][i] = 0;
      S[i] = S[i - 1] + DP[0][i];
    }
    for (int i = 1; i <= N; i++) {
      if (i == B) continue;
      if (first[i] != 0)
        DP[1][i] = S[last[i]] - S[i] + S[i - 1] - S[first[i] - 1];
    }
    for (int i = 1; i <= N; i++) DP[0][i] = DP[1][i] % MOD;
  }
  long long ret = 0;
  for (int i = 1; i <= N; i++) ret += DP[0][i];
  cout << ret % MOD << endl;
  return 0;
}
