#include <bits/stdc++.h>
long long inf = 1LL << 62;
long long mod = 1000000007;
using namespace std;
int n, a, b;
long long dp[5001][5001];
long long getsum(int i, int j, int k) {
  i = max(i, 1);
  j = min(j, n);
  return (dp[j][k] - dp[i - 1][k] + 2 * mod) % mod;
}
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int k;
  cin >> n >> a >> b >> k;
  for (int i = 1; i <= n; i++) dp[i][0] = 1 + dp[i - 1][0];
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      dp[j][i] = dp[j - 1][i];
      if (j != b)
        dp[j][i] += getsum(j - (abs(j - b) - 1), j - 1, i - 1) +
                    getsum(j + 1, j + (abs(j - b) - 1), i - 1);
      dp[j][i] %= mod;
    }
  }
  cout << getsum(a, a, k);
  return 0;
}
