#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int n, a, b, k;
long long imp[5005];
long long sum[5005];
using namespace std;
void calc() {
  sum[0] = 0;
  for (int i = 0; i < b; i++) {
    sum[i + 1] = sum[i] + imp[i];
    if (sum[i + 1] >= mod) {
      sum[i + 1] -= mod;
    }
  }
}
int main() {
  cin >> n >> a >> b >> k;
  a--;
  b--;
  if (a > b) {
    int df = a - b;
    b = n - 1 - b;
    a = b - df;
  }
  imp[a] = 1;
  calc();
  memset(imp, 0, sizeof(imp));
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < b; j++) {
      int t = (b + j) / 2;
      if (((b + j) & 1) == 0) {
        t--;
      }
      imp[j] = sum[t + 1] - (sum[j + 1] - sum[j]);
      if (imp[j] >= mod) {
        imp[j] -= mod;
      }
      if (imp[j] < 0) {
        imp[j] += mod;
      }
    }
    calc();
    memset(imp, 0, sizeof(imp));
  }
  cout << sum[b] << endl;
  return 0;
}
