#include <bits/stdc++.h>
using namespace std;
const int NMAX = 5005;
const int KMAX = 5005;
const int MOD = 1000000007;
int dp[NMAX][KMAX], sum[NMAX][KMAX];
int main() {
  cin.sync_with_stdio(false);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  for (int i = 1; i <= n; ++i) {
    if (i == b)
      dp[i][0] = 0;
    else
      dp[i][0] = 1;
    sum[i][0] = sum[i - 1][0] + dp[i][0];
  }
  for (int j = 1; j <= k; ++j) {
    for (int i = 1; i <= n; ++i) {
      if (i == b) {
        dp[i][j] = 0;
        sum[i][j] = sum[i - 1][j];
        continue;
      }
      int x = abs(b - i);
      int L = max(1, i - x + 1);
      int R = min(n, i + x - 1);
      dp[i][j] = sum[R][j - 1] - sum[L - 1][j - 1];
      if (dp[i][j] < 0) dp[i][j] += MOD;
      dp[i][j] -= dp[i][j - 1];
      if (dp[i][j] < 0) dp[i][j] += MOD;
      sum[i][j] = sum[i - 1][j] + dp[i][j];
      if (sum[i][j] >= MOD) sum[i][j] -= MOD;
    }
  }
  cout << dp[a][k] << "\n";
  return 0;
}
