#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 5;
const long long mod = 1e9 + 7;
int n, a, b, k, lim;
long long q, w, e, r;
int dp[maxn][maxn];
int sum[maxn][maxn];
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> a >> b >> k;
  lim = abs(a - b);
  if (lim == 1) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (i == a || i == b) continue;
    if (abs(a - i) < lim) dp[1][i]++;
  }
  for (int i = 1; i <= n; i++) {
    q = (((dp[1][i] + mod) % mod) + ((sum[1][i - 1] + mod) % mod) + mod) % mod;
    sum[1][i] = q;
  }
  for (int i = 2; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j == b) {
        dp[i][j] = 0;
        q = (sum[i][j - 1] + mod) % mod;
        sum[i][j] = q;
        continue;
      }
      if (j < b) {
        int tmp = (b - j) / 2;
        tmp++;
        q = (((sum[i - 1][b - tmp] + mod) % mod) - dp[i - 1][j] + mod) % mod;
        dp[i][j] = q;
      } else if (j > b) {
        int tmp = (j - b) / 2;
        tmp++;
        q = (((sum[i - 1][n] + mod) % mod) -
             ((sum[i - 1][b + tmp - 1] + mod) % mod)) -
            dp[i - 1][j];
        q += mod;
        q %= mod;
        dp[i][j] = q;
      }
      q = (dp[i][j] + sum[i][j - 1] + mod) % mod;
      sum[i][j] = q;
    }
  }
  cout << ((sum[k][n] + mod) % mod) << "\n";
  return 0;
}
