#include <bits/stdc++.h>
using namespace std;
long long const MAXN = 5e3 + 8;
long long const INF = 1e12 + 8;
long long const delta = 1000000007;
long long dp[MAXN][MAXN];
long long sum[MAXN];
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[a][0] = 1;
  for (long long i = 0; i < MAXN; i++) sum[i] = sum[i - 1] + dp[i][0];
  for (long long i = 1; i <= k; i++) {
    for (long long j = 1; j <= n; j++) {
      if (j == b) continue;
      if (j > b) {
        long long mid = (j + b) / 2;
        mid++;
        long long t = sum[n];
        t += delta;
        t -= sum[mid - 1];
        t += delta;
        t -= dp[j][i - 1];
        t %= delta;
        dp[j][i] += t;
        dp[j][i] %= delta;
      } else {
        long long mid = (j + b - 1) / 2;
        long long t = sum[mid];
        t += delta;
        t -= dp[j][i - 1];
        t %= delta;
        dp[j][i] += t;
        dp[j][i] %= delta;
      }
    }
    for (long long j = 1; j <= n; j++) {
      sum[j] = sum[j - 1] + dp[j][i];
      sum[j] %= delta;
    }
  }
  cout << sum[n];
  return 0;
}
