#include <bits/stdc++.h>
using namespace std;
const long long N = 5002;
const long long mod = 1e9 + 7;
long long dp[N][N];
void solve() {
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  if (a > b) {
    long long diff = abs(a - b);
    a = n - a + 1;
    b = a + diff;
  }
  dp[0][a] = 1;
  for (long long i = 1; i <= k; ++i) {
    for (long long j = 1; j < b; ++j)
      dp[i - 1][j] += dp[i - 1][j - 1], dp[i][j] %= mod;
    for (long long j = 1; j <= b - 1; ++j) {
      long long dis = (j + b - 1) / 2;
      dp[i][j] += dp[i - 1][dis];
      dp[i][j] -= (dp[i - 1][j] - dp[i - 1][j - 1]);
      dp[i][j] += mod;
      dp[i][j] %= mod;
    }
  }
  long long ans = 0;
  for (long long j = 1; j <= n; ++j) ans += dp[k][j], ans %= mod;
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
}
