#include <bits/stdc++.h>
using namespace std;
const int N = 5555;
const int MOD = 1000000007;
int n, k, a, b, l[N], r[N];
long long acc[N], ans[N];
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &k);
  for (int i = 1; i <= n; i++) {
    int d = abs(i - b);
    l[i] = max(1, i - d + 1);
    r[i] = min(n, i + d - 1);
    ans[i] = 1;
  }
  ans[b] = 0;
  for (int i = 0; i < k; i++) {
    acc[0] = 0;
    for (int j = 1; j <= n; j++) {
      acc[j] = acc[j - 1] + ans[j];
    }
    for (int j = 1; j <= n; j++) {
      ans[j] = (acc[r[j]] - acc[l[j] - 1] - ans[j]) % MOD;
    }
    ans[b] = 0;
  }
  printf("%d\n", (int)ans[a]);
  return 0;
}
