#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T x) {
  return x * x;
}
const int inf = 1e9 + 7;
const long long llinf = (long long)1e18;
const unsigned long long ullinf = (unsigned long long)1e19;
const long double eps = 1e-7;
int n, a, b, k;
int f[5100][5100];
int sum[5100];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  f[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      sum[j] = (sum[j - 1] + f[i - 1][j]) % inf;
    }
    for (int j = 1; j <= n; j++) {
      if (j < b) {
        f[i][j] = (f[i][j] + sum[(b + j + 1) / 2 - 1]) % inf;
      } else if (j > b) {
        f[i][j] = (f[i][j] + sum[n] - sum[(b + j) / 2]) % inf;
        if (f[i][j] < 0) {
          f[i][j] += inf;
        }
      }
      f[i][j] -= f[i - 1][j];
      if (f[i][j] < 0) {
        f[i][j] += inf;
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = (ans + f[k][i]) % inf;
  }
  printf("%d", ans);
}
