#include <bits/stdc++.h>
using namespace std;
int f[5005][5005];
int n, m, a, b;
inline int add(int x, int y) {
  long long r = x + (long long)y;
  if (r >= 1000000007) r %= 1000000007;
  if (r < 0) r += 1000000007;
  return (int)r;
}
inline void changerange(int color, int x, int y, int delta) {
  if (x > y) return;
  f[color][x] = add(f[color][x], delta);
  f[color][y + 1] = add(f[color][y + 1], -delta);
}
int main() {
  int i, j, result = 0, k;
  scanf("%d%d%d%d", &n, &a, &b, &m);
  changerange(1, max(1, a - abs(b - a) + 1), a - 1, 1);
  changerange(1, a + 1, min(abs(b - a) + a - 1, n), 1);
  for (j = 2; j <= n; j++) f[1][j] = add(f[1][j], f[1][j - 1]);
  for (i = 1; i <= m - 1; i++) {
    for (j = 1; j <= n; j++) {
      k = f[i][j];
      if (k == 0) continue;
      changerange(i + 1, max(1, j - abs(b - j) + 1), j - 1, k);
      changerange(i + 1, j + 1, min(j + abs(b - j) - 1, n), k);
    }
    for (j = 2; j <= n; j++) f[i + 1][j] = add(f[i + 1][j], f[i + 1][j - 1]);
  }
  for (i = 1; i <= n; i++) result = add(result, f[m][i]);
  printf("%d\n", result);
}
