#include <bits/stdc++.h>
int abs(int x) { return x >= 0 ? x : -x; }
int L[5001];
int R[5001];
long long dp[2][5001];
long long sum[5001];
int main() {
  int n, a, b, k;
  scanf("%d %d %d %d", &n, &a, &b, &k);
  int i, j;
  int l = 1, r = 1;
  for (i = 1; i < b; i++) {
    while (abs(r - i) < abs(r - b)) r++;
    L[i] = l;
    R[i] = r - 1;
  }
  l = n;
  r = n;
  for (i = n; i > b; i--) {
    while (abs(l - i) < abs(l - b)) l--;
    L[i] = l + 1;
    R[i] = r;
  }
  for (i = 1; i <= n; i++) dp[0][i] = 0;
  dp[0][a] = 1;
  for (i = 1; i <= k; i++) {
    int p = (i + 1) % 2;
    int q = i % 2;
    sum[0] = 0;
    for (j = 1; j <= n; j++) sum[j] = (sum[j - 1] + dp[p][j]) % 1000000007;
    for (j = 1; j <= n; j++) {
      if (j == b)
        dp[q][j] = 0;
      else
        dp[q][j] = (sum[R[j]] - sum[L[j] - 1] - dp[p][j] + 1000000007 * 2) %
                   1000000007;
    }
  }
  int ans = 0;
  for (i = 1; i <= n; i++) ans = (ans + dp[k % 2][i]) % 1000000007;
  printf("%d\n", ans);
  return 0;
}
