#include <bits/stdc++.h>
using namespace std;
const int MX = 5e3 + 1;
int N, K, a, b;
int arr[MX];
long long dp[MX][MX];
long long pref[MX];
long long md = 1e9 + 7;
long long get(int id, int k) {
  if (id > b) return (pref[id] - pref[b + 1] + dp[b + 1][k - 1] + 2 * md) % md;
  return pref[b - 1] % md;
}
int main() {
  cin >> N >> a >> b >> K;
  for (int i = 0; i <= N; i++) dp[i][0] = 1;
  if (abs(a - b) <= 1) return cout << 0, 0;
  for (int k = 1; k <= K; k++) {
    memset(pref, 0, sizeof pref);
    for (int i = 1; i <= N; i++)
      pref[i] = (pref[i - 1] + dp[i][k - 1] + 2 * md) % md;
    for (int i = 1; i <= N; i++) {
      if (i == b) continue;
      int st, ed, df = abs(i - b) - 1;
      if (b > i) {
        st = max(1, i - df);
        ed = min(b - 1, i + df);
        if (ed == b - 1 && k > 1) ed--;
      } else {
        st = max(b + 1, i - df);
        if (st == b + 1 && k > 1) st++;
        ed = min(N, i + df);
      }
      dp[i][k] = (pref[ed] - pref[st - 1] - dp[i][k - 1] + 3 * md) % md;
    }
  }
  cout << (dp[a][K] + 3 * md) % md << "\n";
  return 0;
}
