#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int dp[5005][5005];
int n, a, b, k;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  --a;
  --b;
  if (a < b)
    n = b;
  else {
    a = n - a - 1;
    n = n - b - 1;
  }
  dp[0][a] = 1;
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j < n; ++j)
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1]) % mod;
    int add = 0, cur = n - 2;
    for (int j = n - 3; j >= 0; --j) {
      add = (add + dp[i - 1][j + 1]) % mod;
      if (n - cur == cur - j) {
        add = (add + mod - dp[i - 1][cur]) % mod;
        --cur;
      }
      dp[i][j] = (dp[i][j] + add) % mod;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) ans = (ans + dp[k][i]) % mod;
  cout << ans << endl;
  return 0;
}
