#include <bits/stdc++.h>
using namespace std;
static const long long maxn = 5000 + 5;
static const long long MOD = 1e9 + 7;
long long N, A, B, K;
long long dp[2][maxn];
long long cum_dp[2][maxn];
int main() {
  ios::sync_with_stdio(0);
  memset(dp, 0, sizeof(dp));
  memset(cum_dp, 0, sizeof(cum_dp));
  cin >> N >> A >> B >> K;
  if (A > B) {
    A = N + 1 - A;
    B = N + 1 - B;
  }
  dp[0][A] = 1;
  for (int i = A; i < B; i++) cum_dp[0][i] = 1;
  for (long long i = 1; i <= K; i++) {
    for (long long j = 1; j < B; j++) {
      dp[i % 2][j] =
          (cum_dp[1 - i % 2][(j + B - 1) / 2] - dp[1 - i % 2][j] + MOD) % MOD;
      cum_dp[i % 2][j] = (cum_dp[i % 2][j - 1] + dp[i % 2][j]) % MOD;
    }
  }
  long long ret = 0;
  for (long long i = 0; i < N; i++) {
    ret = (ret + dp[K % 2][i]) % MOD;
  }
  cout << ret << endl;
  return 0;
}
