#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const long long linf = 1e18 + 5;
const int N = 5000 + 5;
const int mod = 1e9 + 7;
int n, a, b, k, dp[N][N], dp2[N][N];
int main() {
  ios ::sync_with_stdio(0);
  cin >> n >> a >> b >> k;
  for (int i = 1; i <= n; i++) {
    dp[k + 1][i] = 1;
    dp2[k + 1][i] = i;
  }
  int go;
  for (int t = k; t >= 1; t--)
    for (int x = 1; x <= n; x++) {
      go = abs(b - x) - 1;
      dp[t][x] = dp2[t + 1][min(n, x + go)] - dp2[t + 1][x];
      dp[t][x] = (dp[t][x] % mod + mod) % mod;
      if (x > 1)
        dp[t][x] +=
            ((dp2[t + 1][x - 1] - dp2[t + 1][max(1, x - go) - 1]) % mod + mod) %
            mod;
      dp[t][x] = (dp[t][x] % mod + mod) % mod;
      dp2[t][x] = (dp2[t][x - 1] + dp[t][x]) % mod;
    }
  cout << dp[1][a] << '\n';
  return 0;
}
