#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
const long long mod = 1000000007;
int d[2][5010], s[5010];
int main() {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  --a;
  --b;
  for (int i = 0; i < int(n); ++i) {
    d[0][i] = 0;
  }
  d[0][a] = 1;
  for (int q = 0; q < int(k); ++q) {
    s[0] = 0;
    for (int i = 0; i < int(n); ++i) {
      s[i + 1] = (s[i] + d[q & 1][i]) % mod;
    }
    for (int i = 0; i < int(n); ++i) {
      int res = 0;
      if (i < b) {
        res = (s[i + ((b - i + 1) >> 1)] - d[q & 1][i] + mod) % mod;
      } else if (i > b) {
        res = (s[n] - s[b + ((i - b) >> 1) + 1] + mod) % mod;
        res = (res - d[q & 1][i] + mod) % mod;
      }
      d[(q + 1) & 1][i] = res;
    }
  }
  int ans = 0;
  for (int i = 0; i < int(n); ++i) {
    ans += d[k & 1][i];
    ans %= mod;
  }
  cout << ans;
  return 0;
}
