#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAXN = 5002;
int dp[2][MAXN], N, a, b, k;
inline void tambah(int p, int q, int r, int s) {
  dp[p][q] += dp[r][s];
  while (dp[p][q] >= MOD) dp[p][q] -= MOD;
}
inline void kurang(int p, int q, int r, int s) {
  dp[p][q] -= dp[r][s];
  while (dp[p][q] < 0) dp[p][q] += MOD;
}
int main() {
  scanf("%d%d%d%d", &N, &a, &b, &k);
  a--;
  b--;
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    int curr = i % 2;
    int previ = 1 - curr;
    for (int i = 0; i <= N; i++) dp[curr][i] = 0;
    for (int loc = 0; loc < N; loc++) {
      int diff = abs(b - loc) - 1;
      if (diff <= 0) continue;
      int left = max(0, loc - diff);
      int right = min(N - 1, loc + diff);
      if (left == loc) {
        tambah(curr, loc + 1, previ, loc);
        kurang(curr, right + 1, previ, loc);
      } else {
        tambah(curr, left, previ, loc);
        kurang(curr, loc, previ, loc);
        if (right != loc) {
          tambah(curr, loc + 1, previ, loc);
          kurang(curr, right + 1, previ, loc);
        }
      }
    }
    for (int loc = 1; loc < N; loc++) tambah(curr, loc, curr, loc - 1);
  }
  int ans = 0;
  int ansloc = k % 2;
  for (int i = 0; i < N; i++) {
    ans += dp[ansloc][i];
    while (ans >= MOD) ans -= MOD;
  }
  printf("%d\n", ans);
  return 0;
}
