#include <bits/stdc++.h>
using namespace std;
int n, a, b, K;
const int N = 5000 + 5, mod = 1e9 + 7;
int dp[N][N] = {0};
void solve() {
  int l, r;
  if (a < b)
    l = 1, r = b - 1;
  else
    l = b + 1, r = n;
  dp[0][a] = 1;
  for (int k = 0; k < K; k++) {
    for (int i = l; i <= r; i++) {
      int d = abs(i - b);
      dp[k + 1][max(1, i - (d - 1))] += dp[k][i];
      dp[k + 1][max(1, i - (d - 1))] %= mod;
      dp[k + 1][min(n + 1, i + d)] -= dp[k][i];
      dp[k + 1][min(n + 1, i + d)] = (dp[k + 1][min(n + 1, i + d)] + mod) % mod;
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
      res = (res + dp[k + 1][i]) % mod;
      dp[k + 1][i] = res;
    }
    for (int i = 1; i <= n; i++) {
      dp[k + 1][i] -= dp[k][i];
      dp[k + 1][i] += mod;
      dp[k + 1][i] %= mod;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + dp[K][i]) % mod;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> a >> b >> K;
  solve();
}
