#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = LLONG_MAX;
const int inf = INT_MAX;
const int nmax = 5e3 + 5;
const int mod = 1e9 + 7;
using namespace std;
long long i, a, b, n, j, k, dp[nmax][nmax], sum[nmax], l, r;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n >> a >> b >> k;
  for (i = 1; i <= n; i++) dp[0][i] = 1;
  for (i = 1; i <= k; i++) {
    for (j = 1; j <= n; j++) sum[j] = (sum[j - 1] + dp[i - 1][j]) % mod;
    for (j = 1; j <= n; j++)
      if (j != b) {
        l = max(1LL, j - (abs(j - b) - 1LL)), r = min(j + abs(j - b) - 1LL, n);
        dp[i][j] = (sum[r] - sum[l - 1] - dp[i - 1][j] + mod + mod) % mod;
      }
  }
  cout << dp[k][a] << endl;
  return 0;
}
