#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[2][5001] = {0}, sum[5001] = {0};
  int n, a, b, k, now, prev, i, j, temp;
  cin >> n >> a >> b >> k;
  if (a < b) {
    b = n - b + 1;
    a = n - a + 1;
  }
  arr[1][a] = 1;
  now = 0;
  prev = 1;
  for (j = b + 1; j <= n; j++) {
    sum[j] = sum[j - 1] + arr[prev][j];
  }
  for (i = 0; i < k; i++) {
    for (j = b + 1; j <= n; j++) {
      arr[now][j] = sum[n] - sum[b + (int)(j - b) / 2] - arr[prev][j];
      arr[now][j] = arr[now][j] % 1000000007;
      while (arr[now][j] < 0) arr[now][j] += 1000000007;
    }
    for (j = b + 1; j <= n; j++) {
      sum[j] = sum[j - 1] + arr[now][j];
      sum[j] = sum[j] % 1000000007;
      while (sum[j] < 0) sum[j] += 1000000007;
    }
    temp = now;
    now = prev;
    prev = temp;
  }
  cout << sum[n];
  return 0;
}
