#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5010;
const int MOD = 1000000007;
const int MAXK = 5010;
int dp[MAXK][MAXN];
int sum[MAXK][MAXN];
int main(void) {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      sum[i - 1][j] = (sum[i - 1][j - 1] + dp[i - 1][j]) % MOD;
    }
    for (int j = 1; j <= n; j++) {
      if (j < b) {
        int mid = (j + b + 1) / 2;
        while (mid - j >= b - mid) mid--;
        dp[i][j] = (sum[i - 1][mid] - dp[i - 1][j]) % MOD;
        if (dp[i][j] < 0) dp[i][j] += MOD;
      } else if (j > b) {
        int mid = (j + b - 1) / 2;
        while (j - mid >= mid - b) mid++;
        mid--;
        dp[i][j] = (sum[i - 1][n] - sum[i - 1][mid] - dp[i - 1][j]) % MOD;
        if (dp[i][j] < 0) dp[i][j] += MOD;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + dp[k][i]) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
