#include <bits/stdc++.h>
using namespace std;
const int NMAX = 5007;
const int MOD = 1e9 + 7;
int n, a, b, k, dp[NMAX][NMAX], parc[NMAX][NMAX];
int main() {
  cin >> n >> a >> b >> k;
  dp[a][0] = 1;
  for (int i = 1; i <= n; i++) {
    if (i == b) continue;
    parc[i][0] = parc[i - 1][0] + dp[i][0];
  }
  for (int j = 1; j <= k; j++) {
    for (int i = 1; i <= n; i++) {
      if (i == b) continue;
      if (i < b) {
        int x = (b - i - 1) / 2 + i;
        dp[i][j] = parc[x][j - 1] - parc[0][j - 1] - dp[i][j - 1];
        while (dp[i][j] < 0) dp[i][j] += MOD;
        parc[i][j] = parc[i - 1][j] + dp[i][j];
        parc[i][j] %= MOD;
      } else if (i > b) {
        int x = i - (i - b - 1) / 2;
        dp[i][j] = parc[n][j - 1] - parc[x - 1][j - 1] - dp[i][j - 1];
        while (dp[i][j] < 0) dp[i][j] += MOD;
        parc[i][j] = parc[i - 1][j] + dp[i][j];
        parc[i][j] %= MOD;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp[i][k]) % MOD;
  cout << ans;
  return 0;
}
