#include <bits/stdc++.h>
int main() {
  static int dp[5000], dq[5000];
  int n, a, b, k, i, ans;
  scanf("%d%d%d%d", &n, &a, &b, &k), a--, b--;
  if (a < b) {
    n = b + 1;
    a = b - a;
  } else {
    n -= b;
    a -= b;
  }
  dp[a] = 1;
  while (k--) {
    memset(dq, 0, n * sizeof *dq);
    for (i = 2; i < n; i++) {
      int x = dp[i];
      if (x) {
        dq[1] = (dq[1] + x) % 1000000007;
        dq[i] = (dq[i] - x) % 1000000007;
        if (i + 1 < n) dq[i + 1] = (dq[i + 1] + x) % 1000000007;
        if (i + i < n) dq[i + i] = (dq[i + i] - x) % 1000000007;
      }
    }
    for (i = 1; i < n; i++) dp[i] = (dq[i] + dp[i - 1]) % 1000000007;
  }
  ans = 0;
  for (i = 1; i < n; i++) ans = (ans + dp[i]) % 1000000007;
  if (ans < 0) ans += 1000000007;
  printf("%d\n", ans);
  return 0;
}
