#include <bits/stdc++.h>
const int MOD = 1000000007;
const int N = 5005;
int d[2][N], n, a, b, k;
bool read() {
  if (scanf("%d %d %d %d", &n, &a, &b, &k) != 4) return false;
  a--, b--;
  return true;
}
int add(int a, int b) {
  int res = a + b;
  while (res >= MOD) res -= MOD;
  while (res < 0) res += MOD;
  return res;
}
int abs(int a) {
  if (a < 0) return -a;
  return a;
}
void solve() {
  d[0][a] = 1;
  for (int it = 0; it < int(k); it++) {
    int i = it & 1;
    int nxt = i ^ 1;
    for (int j = 0; j < int(n); j++) d[nxt][j] = 0;
    for (int j = 0; j < int(n); j++) {
      int dv = d[i][j];
      int diff = abs(j - b);
      d[nxt][std::max(j - diff + 1, 0)] =
          add(d[nxt][std::max(j - diff + 1, 0)], dv);
      d[nxt][std::min(j + diff, N - 1)] =
          add(d[nxt][std::min(j + diff, N)], -dv);
    }
    for (int j = 0; j < int(n); j++)
      if (j > 0) d[nxt][j] = add(d[nxt][j], d[nxt][j - 1]);
    for (int j = 0; j < int(n); j++) d[nxt][j] = add(d[nxt][j], -d[i][j]);
  }
  int ans = 0;
  for (int j = 0; j < int(n); j++) ans = add(ans, d[k & 1][j]);
  printf("%d\n", ans);
}
int main() {
  if (!read()) throw;
  solve();
}
