#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
template <typename T>
void chadd(T &a, T b) {
  a = a + b;
}
long long int dx[] = {0, 0, 1, -1};
long long int dy[] = {1, -1, 0, 0};
const long long INF = 1001001001001001LL;
const long long MOD = 1000000007LL;
long long int dp[2][5010];
signed main() {
  long long int N, A, B, K;
  cin >> N >> A >> B >> K;
  A--;
  B--;
  dp[0][A] = 1;
  for (long long int i = 0; i < K; i++) {
    long long int cur = i % 2, nxt = 1 - cur;
    for (long long int j = 0; j < N; j++) {
      if (j < B) {
        (dp[nxt][B] += MOD - dp[cur][j]) %= MOD;
        (dp[nxt][max(0LL, 2 * j - B + 1)] += dp[cur][j]) %= MOD;
      }
      if (j > B) {
        (dp[nxt][min(N, 2 * j - B)] += MOD - dp[cur][j]) %= MOD;
        (dp[nxt][B + 1] += dp[cur][j]) %= MOD;
      }
    }
    for (long long int j = 0; j < N; j++) (dp[nxt][j + 1] += dp[nxt][j]) %= MOD;
    for (long long int j = 0; j < N; j++) {
      (dp[nxt][j] += MOD - dp[cur][j]) %= MOD;
      dp[cur][j] = 0;
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < N; i++) {
    (ans += dp[K % 2][i]) %= MOD;
  }
  cout << ans << endl;
  return 0;
}
