#include <bits/stdc++.h>
using namespace std;
const long long int mx = 5e3 + 1, Mod = 1e9 + 7;
int n, dp[mx][mx], ps[mx], a, b, k;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> a >> b >> k;
  a--;
  b--;
  for (int i = 0; i < n; i++) dp[0][i] = 0;
  dp[0][a] = 1;
  ps[0] = dp[0][0];
  for (int i = 1; i < n; i++) ps[i] = ps[i - 1] + dp[0][i];
  for (int w = 1; w <= k; w++) {
    for (int i = 0; i < n; i++) {
      if (i == b) {
        dp[w][i] = 0;
        continue;
      }
      if (i < b)
        dp[w][i] =
            ((0LL + ps[(i + b + 1) / 2 - 1] - dp[w - 1][i]) % Mod + Mod) % Mod;
      else
        dp[w][i] =
            ((0LL + ps[n - 1] - ps[(i + b) / 2] - dp[w - 1][i]) % Mod + Mod) %
            Mod;
    }
    ps[0] = dp[w][0];
    for (int i = 1; i < n; i++) ps[i] = (0LL + ps[i - 1] + dp[w][i]) % Mod;
  }
  cout << ps[n - 1] << '\n';
  return 0;
}
