#include <bits/stdc++.h>
const int N = 5050, M = 1000000007;
int a[N][2], c[N], n, x, y, k, i, j, s, kx, ky;
inline int abs(int n) { return n >= 0 ? n : -n; }
int main() {
  scanf("%d%d%d%d", &n, &x, &y, &k);
  if (y < x) {
    x = n - x + 1;
    y = n - y + 1;
  }
  n = y - 1;
  --x;
  kx = 0, ky = 1;
  a[x][kx] = 1;
  c[0] = a[0][kx];
  for (i = 1; i < n; i++) c[i] = (c[i - 1] + a[i][kx]) % M;
  while (k--) {
    for (i = 0; i < n; i++) {
      a[i][ky] = 0;
      j = (n + i) / 2;
      while (j + j < n + i) ++j;
      --j;
      a[i][ky] = c[j];
      a[i][ky] -= a[i][kx];
      if (a[i][ky] < 0) a[i][ky] += M;
    }
    c[0] = a[0][ky];
    for (i = 1; i < n; i++) c[i] = (c[i - 1] + a[i][ky]) % M;
    kx ^= 1, ky ^= 1;
  }
  s = 0;
  for (i = 0; i < n; i++) s = (s + a[i][kx]) % M;
  if (s < 0) s += M;
  printf("%d\n", s);
  return 0;
}
