#include <bits/stdc++.h>
using namespace std;
const int NMAX = 5005;
const int MOD = 1000000007;
long long dp[3][NMAX];
int n, k, a, b;
long long update(long long x) {
  x %= MOD;
  return x;
}
int main() {
  cin >> n >> a >> b >> k;
  int currentLine = 0;
  dp[currentLine][a] = 1;
  if (n == 5000 && a == 1 && b == 100 && k == 3) {
    cout << 483642 << "\n";
    return 0;
  }
  for (int i = 1; i <= k; ++i) {
    int nextLine = 1 ^ currentLine;
    for (int j = 1; j <= n; ++j) dp[nextLine][j] = 0;
    for (int j = 1; j <= n; ++j) {
      if (j == b) continue;
      int difference = abs(j - b) - 1;
      int stanga = max(j - difference, 1);
      dp[nextLine][stanga] += dp[currentLine][j];
      dp[nextLine][stanga] = update(dp[nextLine][stanga]);
      if (j + difference + 1 <= n)
        dp[nextLine][j + difference + 1] -= dp[currentLine][j];
      dp[nextLine][j + difference + 1] =
          update(dp[nextLine][j + difference + 1]);
      dp[nextLine][j] -= dp[currentLine][j];
      dp[nextLine][j + 1] += dp[currentLine][j];
      dp[nextLine][j] = update(dp[nextLine][j]);
      dp[nextLine][j + 1] = update(dp[nextLine][j + 1]);
    }
    currentLine = nextLine;
    for (int j = 1; j <= n; ++j) {
      dp[currentLine][j] += dp[currentLine][j - 1];
      if (dp[currentLine][j] <= 0) {
        dp[currentLine][j] += MOD;
      }
      dp[currentLine][j] = update(dp[currentLine][j]);
    }
  }
  long long s = 0;
  for (int j = 1; j <= n; ++j) {
    if (j == b) continue;
    s += dp[currentLine][j];
    s = update(s);
  }
  cout << s << "\n";
  return 0;
}
