#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N = 5005;
const long long mod = 1000000007;
int a, b, K, n;
long long dp[N][N], sum[N];
long long solve() {
  dp[0][a] = 1;
  for (int k = 1; k <= K; k++) {
    sum[0] = 0;
    for (int i = 1; i <= n; i++) {
      sum[i] = sum[i - 1] + dp[k - 1][i];
      if (sum[i] >= mod) sum[i] -= mod;
    }
    for (int i = 1, j; i <= n; i++) {
      if (i == b) continue;
      j = (b + i) >> 1;
      if (i < b) {
        if (b - j <= j - i) j--;
        dp[k][i] = sum[j] - dp[k - 1][i];
      } else {
        if (j - b <= i - j) j++;
        dp[k][i] = sum[n] - sum[j - 1] - dp[k - 1][i];
      }
      if (dp[k][i] < 0) {
        dp[k][i] %= mod;
        dp[k][i] += mod;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[K][i];
    if (ans >= mod) ans -= mod;
  }
  return ans;
}
int main() {
  while (cin >> n >> a >> b >> K) {
    memset(dp, 0, sizeof dp);
    int hehe;
    cout << solve() % mod << endl;
  }
  return 0;
}
