#include <bits/stdc++.h>
using namespace std;
int dp[5005][5005];
int MIN(int a, int b) {
  if (a > b) return b;
  return a;
}
int MAX(int a, int b) {
  if (a > b) return a;
  return b;
}
int main() {
  int n, a, b, k, i, j, len, l, r, ans = 0;
  scanf("%d %d %d %d", &n, &a, &b, &k);
  dp[0][a] = 1;
  for (j = 0; j <= k; j++) {
    for (i = 1; i <= n; ++i) {
      if (i != b) {
        len = abs(i - b) - 1;
        l = max(i - len, 1);
        r = min(i + len, n);
        dp[j + 1][l] = (dp[j + 1][l] + dp[j][i]) % 1000000007;
        dp[j + 1][i] = (dp[j + 1][i] - dp[j][i] + 1000000007) % 1000000007;
        dp[j + 1][i + 1] = (dp[j + 1][i + 1] + dp[j][i]) % 1000000007;
        dp[j + 1][r + 1] =
            (dp[j + 1][r + 1] - dp[j][i] + 1000000007) % 1000000007;
      }
    }
    for (i = 1; i <= n; i++) {
      dp[j + 1][i] = (dp[j + 1][i] + dp[j + 1][i - 1]) % 1000000007;
    }
  }
  for (j = 1; j <= n; j++) {
    ans += dp[k][j];
    ans = ans % 1000000007;
  }
  printf("%d\n", ans);
  return 0;
}
