#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  --a;
  --b;
  vector<vector<long long> > dp(2, vector<long long>(n, 0));
  vector<long long> pref(n), suf(n);
  dp[0][a] = 1;
  for (int i = 1; i <= k; ++i) {
    pref[0] = dp[(i % 2) ^ 1][0];
    for (int l = 1; l < n; ++l)
      pref[l] = (pref[l - 1] + dp[(i % 2) ^ 1][l]) % MOD;
    suf[n - 1] = dp[(i % 2) ^ 1][n - 1];
    for (int l = n - 2; l >= 0; --l)
      suf[l] = (suf[l + 1] + dp[(i % 2) ^ 1][l]) % MOD;
    for (int j = 0; j < n; ++j) {
      if (j == b) continue;
      if (j < b) {
        if ((b - j + 1) % 2 == 0)
          dp[i % 2][j] = pref[(j + b) / 2];
        else
          dp[i % 2][j] = pref[(j + b) / 2 - 1];
      } else
        dp[i % 2][j] = suf[(j + b) / 2 + 1];
      dp[i % 2][j] -= dp[(i % 2) ^ 1][j];
      if (dp[i % 2][j] < 0) dp[i % 2][j] += MOD;
    }
  }
  long long odp = 0;
  for (int i = 0; i < n; ++i) odp = (odp + dp[k % 2][i]) % MOD;
  cout << odp;
  return 0;
}
