#include <bits/stdc++.h>
const double EPS = 1e-10;
const double PI = acos(-1.0);
using namespace std;
int e97 = (int)(1e+9) + 7;
long long dp[5010][5010];
int absint(int a) { return a < 0 ? -a : a; }
int minint(int a, int b) { return a > b ? b : a; }
int maxint(int a, int b) { return a < b ? b : a; }
int main(void) {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  for (int i = (0); i < (5010); ++i)
    for (int j = (0); j < (5010); ++j) dp[i][j] = 0LL;
  for (int j = (0); j < (n); ++j) dp[0][j + 1] = 1;
  for (int i = (0); i < (k); ++i) {
    for (int j = (0); j < (n); ++j) {
      dp[i][j + 1] += dp[i][j];
      dp[i][j + 1] %= e97;
    }
    for (int pos = (1); pos < (n + 1); ++pos) {
      if (pos == b) continue;
      int range = absint(pos - b) - 1;
      dp[i + 1][pos] =
          dp[i][minint(pos + range, n)] - dp[i][maxint(pos - range - 1, 0)];
      dp[i + 1][pos] += e97;
      dp[i + 1][pos] %= e97;
      dp[i + 1][pos] -= dp[i][pos] - dp[i][pos - 1];
      dp[i + 1][pos] += e97;
      dp[i + 1][pos] %= e97;
    }
  }
  cout << dp[k][a] << endl;
  return 0;
}
