#include <bits/stdc++.h>
using namespace std;
template <class T>
void print(T a, T b) {
  for (; a != b; a++) {
    cerr << (*a) << ' ';
  }
}
int gcd(int a, int b) { return (a == 0 ? b : gcd(b % a, a)); }
long long c[5005][5005];
long long sum[5005];
const long long mod = 1e9 + 7;
int N, a, b, K;
int main() {
  scanf("%d%d%d%d", &N, &a, &b, &K);
  if (a > b) {
    a = 1 + N - a;
    b = 1 + N - b;
  }
  for (int k = 0; k <= K; k++) {
    for (int n = 1; n < b; n++) {
      if (k == 0)
        c[n][k] = 1;
      else {
        c[n][k] = (sum[n + (b - n - 1)] - sum[max(n - (b - n - 1) - 1, 0)] -
                   c[n][k - 1] + mod) %
                  mod;
      }
    }
    for (int n = 1; n < b; n++) sum[n] = (sum[n - 1] + c[n][k]) % mod;
  }
  cout << ((c[a][K] + mod) % mod) << endl;
  return 0;
}
