#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 2e9;
const long long INFLL = 1e18;
const int MAX_N = 5000;
int N, K;
int A, B;
long long dp[2][MAX_N + 1];
int main() {
  cin >> N >> A >> B >> K;
  if (A > B) {
    B = N - B + 1;
    A = N - A + 1;
  }
  dp[0][A] = 1;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j < B; j++) {
      if (dp[0][j] == 0) continue;
      int s = max(1, j - (B - 1 - j));
      if (s != j) {
        dp[1][s] = (dp[1][s] + dp[0][j]) % MOD;
        dp[1][j] = (dp[1][j] - dp[0][j] + MOD) % MOD;
      }
      int e = B - 1;
      if (e != j) {
        dp[1][j + 1] = (dp[1][j + 1] + dp[0][j]) % MOD;
        dp[1][e + 1] = (dp[1][e + 1] + dp[0][j]) % MOD;
      }
    }
    for (int j = 1; j < B; j++) {
      dp[0][j] = dp[1][j];
      dp[1][j] = 0;
      dp[0][j] = (dp[0][j - 1] + dp[0][j]) % MOD;
      if (0) cout << dp[0][j] << " ";
    }
    if (0) cout << endl;
  }
  long long ans = 0;
  for (int i = 1; i < B; i++) {
    ans = (ans + dp[0][i]) % MOD;
  }
  cout << ans;
  return 0;
}
