#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, a, b, k;
int f[5005][5005];
int s[5005][5005];
void sum(int t) {
  for (int i = 1; i <= n; i++) s[i][t] = (s[i - 1][t] + f[i][t]) % mod;
}
int main() {
  int i, j;
  scanf("%d%d%d%d", &n, &a, &b, &k);
  memset(s, 0, sizeof(s));
  memset(f, 0, sizeof(f));
  f[a][0] = 1;
  if (a < b) {
    sum(0);
    for (i = 1; i <= k; i++) {
      for (j = 1; j < b; j++)
        f[j][i] = (s[(b + j - 1) >> 1][i - 1] - f[j][i - 1] + mod) % mod;
      sum(i);
    }
  } else {
    sum(0);
    for (i = 1; i <= k; i++) {
      for (j = b + 1; j <= n; j++)
        f[j][i] = ((s[n][i - 1] - s[(b + j) >> 1][i - 1] + mod) % mod -
                   f[j][i - 1] + mod) %
                  mod;
      sum(i);
    }
  }
  long long ans = 0;
  for (i = 1; i <= n; i++) ans = (ans + f[i][k]) % mod;
  printf("%lld", ans);
  return 0;
}
