#include <bits/stdc++.h>
using namespace std;
long long n, a, b, k;
const long long mod = 1e9 + 7;
long long dp[5001][5001];
int main() {
  cin >> n >> a >> b >> k;
  for (int i = 1; i < 5001; i++)
    for (int j = 1; j < 5001; j++) dp[i][j] = 0;
  for (int i = 1; i < 5001; i++)
    if (i != b) dp[i][0] = 1;
  dp[b][0] = 0;
  vector<long long> psumf(n + 2, 0);
  vector<long long> psumr(n + 2, 0);
  for (int mov = 1; mov <= k; mov++) {
    psumf[1] = dp[1][mov - 1];
    for (int fl = 2; fl <= n; fl++) {
      psumf[fl] = dp[fl][mov - 1] + psumf[fl - 1];
      psumf[fl] %= mod;
    }
    psumr[n] = dp[n][mov - 1];
    for (int fl = n - 1; fl >= 1; fl--) {
      psumr[fl] = psumr[fl + 1] + dp[fl][mov - 1];
      psumr[fl] %= mod;
    }
    for (int fl = 1; fl <= n; fl++) {
      if (fl == b) dp[fl][mov] = 0;
      if (fl < b) {
        long long d = b - fl;
        long long start = max((long long)0, fl - d);
        long long end = fl + d - 1;
        dp[fl][mov] = psumf[end] - psumf[start] - dp[fl][mov - 1];
        dp[fl][mov] %= mod;
      } else {
        long long d = fl - b;
        long long start = fl - d + 1;
        long long end = min(n + 1, fl + d);
        dp[fl][mov] = psumr[start] - psumr[end] - dp[fl][mov - 1];
        dp[fl][mov] %= mod;
      }
    }
  }
  cout << (dp[a][k] + mod) % mod << endl;
  return 0;
}
