#include <bits/stdc++.h>
using namespace std;
const int maxn = 5100;
const int mod = 1e9 + 7;
int dp[maxn][maxn];
int main() {
  int n, a, b, k;
  while (cin >> 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 (dp[i][j]) {
          int u = max(1, j - abs(j - b) + 1);
          int v = min(n, j + abs(j - b) - 1) + 1;
          dp[i + 1][u] = (dp[i + 1][u] + dp[i][j]) % mod;
          dp[i + 1][v] = (dp[i + 1][v] - dp[i][j] + mod) % mod;
          if (u <= j && j <= v) {
            dp[i + 1][j] = (dp[i + 1][j] - dp[i][j] + mod) % mod;
            dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % mod;
          }
        }
      }
      for (int j = 2; 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++) {
      ans = (ans + dp[k][i]) % mod;
    }
    ans %= mod;
    cout << ans << endl;
  }
}
