#include <bits/stdc++.h>
using namespace std;
int n, m, a, b;
long long tbl[5001][5001];
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &m);
  if (a > b) {
    a = n - a + 1;
    b = n - b + 1;
  }
  int i, j;
  long long sum;
  tbl[0][a] = 1;
  for (i = 1; i <= m; i++) {
    sum = 0;
    for (j = 1; j < b; j++) sum += tbl[i - 1][j];
    int cnt = 1, now = b - 1;
    for (j = b - 1; j >= 1; j--) {
      tbl[i][j] = (sum - tbl[i - 1][j]) % 1000000007;
      if (cnt == 1) {
        sum -= tbl[i - 1][now--];
        cnt = 0;
      } else
        cnt++;
    }
  }
  sum = 0;
  for (i = 1; i <= n; i++) sum += tbl[m][i];
  printf("%I64d\n", sum % 1000000007);
  return 0;
}
