#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
long long dp[5010][5010];
long long sum[5010];
void refreshSum(int i, int b) {
  sum[0] = 0;
  for (int j = 1; j < b; j++) sum[j] = (sum[j - 1] + dp[i][j]) % MOD;
}
long long findSum(int n, int i, int a) {
  long long ans = 0;
  ans = (sum[n] - dp[i - 1][a]) % MOD;
  ans = (ans + MOD) % MOD;
  return ans;
}
long long solve(int a, int b, int k) {
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    refreshSum(i - 1, b);
    for (int j = 1; j < b; j++) {
      dp[i][j] = findSum((j + b + 1) / 2 - 1, i, j);
    }
  }
  long long ans = 0;
  for (int i = 1; i < b; i++) ans = (ans + dp[k][i]) % MOD;
  ans %= MOD;
  ans += MOD;
  ans %= MOD;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  long long ans;
  if (a < b)
    ans = solve(a, b, k);
  else
    ans = solve(n - a + 1, n - b + 1, k);
  cout << ans << endl;
  return 0;
}
