#include <bits/stdc++.h>
using namespace std;
const int NMAX = 5005;
const int mod = 1000000007;
int dp[NMAX];
int main(int argc, char const *argv[]) {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  if (a > b) {
    a = n + 1 - a;
    b = n + 1 - b;
  }
  if (abs(a - b) == 1) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = a; i <= b - 1; i++) {
    dp[i] = 1;
  }
  for (int i = 0; i < k; i++) {
    int tmp[NMAX];
    fill(begin(tmp), end(tmp), 0);
    for (int to = 1; to < b; to++) {
      int upBound = (to + b - 1) / 2;
      tmp[to] = (tmp[to - 1] + (dp[upBound] - dp[to]) % mod) % mod;
      tmp[to] = (tmp[to] + dp[to - 1]) % mod;
    }
    copy(begin(tmp), end(tmp), begin(dp));
  }
  cout << (dp[b - 1] + mod) % mod << "\n";
  return 0;
}
