#include <bits/stdc++.h>
int n, a, b, k;
int f[5010][5010];
int s[5010];
void updata(int i) {
  s[0] = 0;
  for (int j = 1; j < b; j++) s[j] = (s[j - 1] + f[i][j]) % 1000000007;
}
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  memset(f, 0, sizeof(f));
  if (a > b) {
    a = n - a + 1;
    b = n - b + 1;
  }
  f[0][a] = 1;
  updata(0);
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j < b; j++) {
      f[i][j] =
          (s[(b - j - 1) / 2 + j] - f[i - 1][j] + 1000000007) % 1000000007;
    }
    updata(i);
  }
  printf("%d\n", s[b - 1]);
  return 0;
}
