#include <bits/stdc++.h>
using namespace std;
long long int dp1[5010], dp2[5010];
int main() {
  int n, k, a, b;
  scanf("%d", &n);
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &k);
  for (int i = 0; i < 5010; i++) dp1[i] = 0, dp2[i] = 0;
  dp1[a] = 1;
  for (int lvl = 1; lvl <= k; lvl++) {
    for (int i = 0; i < n + 4; i++) dp2[i] = 0;
    for (int at = 1; at <= n; at++) {
      int l = max(1, at - abs(at - b) + 1), r = min(n, at + abs(at - b) - 1);
      dp2[l] = (dp2[l] + dp1[at]) % 1000000007;
      dp2[at] = (dp2[at] + 1000000007 - dp1[at]) % 1000000007;
      dp2[at + 1] = (dp2[at + 1] + dp1[at]) % 1000000007;
      dp2[r + 1] = (dp2[r + 1] + 1000000007 - dp1[at]) % 1000000007;
    }
    dp1[0] = 0;
    for (int at = 1; at <= n; at++)
      dp2[at] = (dp2[at - 1] + dp2[at]) % 1000000007;
    for (int at = 1; at <= n; at++) dp1[at] = dp2[at];
  }
  long long int ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + dp1[i]) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
