#include <bits/stdc++.h>
using namespace std;
int D[5002][5002];
int SumMod(int x, int y) {
  int rez = x + y;
  while (rez >= 1000000007) rez -= 1000000007;
  while (rez < 0) rez += 1000000007;
  return rez;
}
int main() {
  int N, A, B, K;
  scanf("%d%d%d%d", &N, &A, &B, &K);
  A--;
  B--;
  D[0][A] = 1;
  for (int i = 0; i < K; ++i) {
    for (int j = 0; j < N; ++j) {
      int dif = abs(j - B);
      D[i + 1][max(j - dif + 1, 0)] =
          SumMod(D[i + 1][max(j - dif + 1, 0)], D[i][j]);
      D[i + 1][min(j + dif, 5002 - 1)] =
          SumMod(D[i + 1][min(j + dif, 5002 - 1)], -D[i][j]);
    }
    for (int j = 1; j < N; ++j)
      D[i + 1][j] = SumMod(D[i + 1][j], D[i + 1][j - 1]);
    for (int j = 0; j < N; ++j) D[i + 1][j] = SumMod(D[i + 1][j], -D[i][j]);
  }
  int sol = 0;
  for (int j = 0; j < N; ++j) sol = SumMod(sol, D[K][j]);
  printf("%d", sol);
}
