#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  a--, b--;
  vector<vector<long long> > DP(n, vector<long long>(2, 0));
  vector<long long> PARDP(n);
  int step = 0;
  for (int i = 0; i < n; ++i) {
    DP[i][step] = i == b ? 0 : 1;
    PARDP[i] = (i > 0 ? PARDP[i - 1] : 0) + DP[i][step];
  }
  step = !step;
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j == b) continue;
      int l = max(0, j - abs(j - b) + 1);
      int r = min(n - 1, j + abs(j - b) - 1);
      DP[j][step] = (((j > 0 ? PARDP[j - 1] : 0) - (l > 0 ? PARDP[l - 1] : 0)) +
                     (PARDP[r] - PARDP[j])) %
                    mod;
    }
    PARDP[0] = DP[0][step];
    for (int j = 1; j < n; ++j) {
      PARDP[j] = PARDP[j - 1] + DP[j][step];
    }
    step = !step;
  }
  cout << DP[a][!step] << "\n";
  return 0;
}
