#include <bits/stdc++.h>
using namespace std;
long long modF = 1000000007;
struct mi {
  long long val;
  explicit operator int() const { return val; }
  mi() : val(0) {}
  mi(long long v) : val(v % modF) {}
};
mi operator+(const mi& a, const mi& b) { return (a.val + b.val) % modF; }
mi operator*(const mi& a, const mi& b) { return (a.val * b.val) % modF; }
mi operator-(const mi& a, const mi& b) { return (a.val - b.val + modF) % modF; }
int n, a, k, b;
mi dp[2][5000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> a >> b >> k;
  a--, b--;
  mi ans;
  int crr = 0, prev = 1;
  for (int i = (0); i < (k + 1); i++) {
    for (int j = (0); j < (n); j++) {
      dp[crr][j] = 0;
      if (i == 0) {
        dp[crr][j] = (j == a);
      } else {
        if (j == b) {
          dp[crr][j] = 0;
        } else if (j < b) {
          dp[crr][j] = dp[prev][j + (b - j - 1) / 2] - dp[prev][j] +
                       (j != 0 ? dp[prev][j - 1] : mi(0));
        } else {
          dp[crr][j] = dp[prev][n - 1] - dp[prev][j - (j - b - 1) / 2 - 1] -
                       dp[prev][j] + (j != 0 ? dp[prev][j - 1] : mi(0));
        }
      }
      if (i == k) {
        ans = ans + dp[crr][j];
      }
      if (j != 0) dp[crr][j] = dp[crr][j] + dp[crr][j - 1];
    }
    crr = 1 - crr;
    prev = 1 - prev;
  }
  cout << int(ans) << '\n';
  return 0;
}
