#include <bits/stdc++.h>
using namespace std;
long long dp[5007][5007];
int n, a, b, k;
const long long mod = 1e9 + 7;
int main() {
  while (~scanf("%d%d%d%d", &n, &a, &b, &k)) {
    memset(dp, 0, sizeof(dp));
    dp[0][a] = 1;
    for (int i = 0; i <= k; i++) {
      for (int j = 1; j <= n; j++) {
        if (j == b) continue;
        int d = abs(j - b);
        int l = max(j - d + 1, 1);
        int r = min(j + d, n + 1);
        dp[i + 1][l] += dp[i][j];
        dp[i + 1][l] %= mod;
        dp[i + 1][r] -= dp[i][j];
        dp[i + 1][r] %= mod;
        if (l <= j <= r) {
          dp[i + 1][j] -= dp[i][j];
          dp[i + 1][j] %= mod;
          dp[i + 1][j + 1] += dp[i][j];
          dp[i + 1][j + 1] %= mod;
        }
      }
      for (int j = 1; j <= n; j++) {
        dp[i + 1][j] += dp[i + 1][j - 1];
        dp[i + 1][j] %= mod;
      }
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      if (i == b) continue;
      ans += dp[k][i];
      ans %= mod;
    }
    ans = (ans + mod) % mod;
    printf("%I64d\n", ans);
  }
}
