#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5001;
const int MOD = 1000000000 + 7;
int dp[MAXN][MAXN];
int sum[MAXN][MAXN];
int min_index[MAXN];
int max_index[MAXN];
long long doit(int n, int a, int b, int k) {
  for (int i = 0; i < n; i++) {
    min_index[i] = n - 1;
    max_index[i] = 0;
    for (int j = 0; j < n; j++) {
      if (abs(j - i) < abs(j - b)) {
        min_index[i] = min(min_index[i], j);
        max_index[i] = max(max_index[i], j);
      }
    }
  }
  for (int i = 0; i <= k; i++) {
    for (int j = 0; j < n; j++) {
      if (j == b) {
        dp[i][j] = 0;
      } else if (i == 0) {
        dp[i][j] = j == a;
      } else {
        dp[i][j] = sum[i - 1][max_index[j]];
        if (min_index[j]) {
          dp[i][j] += MOD - sum[i - 1][min_index[j] - 1];
          dp[i][j] %= MOD;
        }
        dp[i][j] += MOD - dp[i - 1][j];
        dp[i][j] %= MOD;
      }
      sum[i][j] = dp[i][j] + (j ? sum[i][j - 1] : 0);
      sum[i][j] %= MOD;
    }
  }
  return sum[k][n - 1];
}
int main() {
  ios::sync_with_stdio(false);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  cout << doit(n, a - 1, b - 1, k) << endl;
  return 0;
}
