#include <bits/stdc++.h>
using namespace std;
long long p[5020], q[5020];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  long long *now = p, *last = q;
  for (long long i = a; i <= n; i++) last[i] = 1;
  while (k--) {
    for (long long i = 1; i <= n; i++) {
      if (i == b)
        now[i] = now[i - 1] + 0;
      else if (i < b) {
        long long r = (i + b) / 2;
        if ((i + b) % 2 == 0) r--;
        long long ans = last[r];
        if (i <= r) ans -= last[i] - last[i - 1];
        ans = (ans % (1000000007) + (1000000007)) % (1000000007);
        now[i] = now[i - 1] + ans;
      } else {
        long long l = (i + b) / 2 + 1;
        long long ans = last[n] - last[l - 1];
        if (i >= l) ans -= last[i] - last[i - 1];
        ans = (ans % (1000000007) + (1000000007)) % (1000000007);
        now[i] = now[i - 1] + ans;
      }
      now[i] = (now[i] % (1000000007) + (1000000007)) % (1000000007);
    }
    swap(now, last);
  }
  cout << (last[n] % (1000000007) + (1000000007)) % (1000000007) << endl;
  return 0;
}
