#include <bits/stdc++.h>
using namespace std;
int n, a, b, K, dp[5005][2], s[5005][2];
int mul(long long x, long long y) { return (x * y) % 1000000007; }
int main() {
  int i, j, k;
  scanf("%d %d %d %d", &n, &a, &b, &K);
  if (a > b) {
    a -= b;
    n -= b;
    b = 0;
  } else {
    a = b - a;
    n = b - 1;
    b = 0;
  }
  for (i = 1; i <= n; i++) {
    dp[i][0] = 1;
    s[i][0] = (s[i - 1][0] + 1) % 1000000007;
  }
  for (k = 1; k <= K; k++) {
    for (i = 1; i <= n; i++)
      dp[i][k % 2] =
          (((s[min(n, 2 * i - 1)][(k + 1) % 2] - dp[i][(k + 1) % 2]) %
            1000000007) +
           1000000007) %
          1000000007;
    for (i = 1; i <= n; i++)
      s[i][k % 2] = (s[i - 1][k % 2] + dp[i][k % 2]) % 1000000007;
  }
  printf("%d\n", dp[a][K % 2]);
  return 0;
}
