#include <bits/stdc++.h>
using namespace std;
long long tree[2][5003], n, a, b, ki, k, curr;
inline long long mod(long long x) {
  return (x % 1000000007ll + 1000000007ll) % 1000000007ll;
}
int main() {
  scanf("%I64d %I64d %I64d %I64d", &n, &a, &b, &ki);
  curr = 0;
  k = 0;
  tree[0][0] = 0ll;
  tree[1][0] = 0ll;
  for (int i = 1; i < n + 1; i++)
    tree[curr][i] = (i == b) ? tree[curr][i - 1] : 1ll + tree[curr][i - 1];
  for (curr ^= 1; k < ki; k++, curr ^= 1) {
    for (int i = 0; i < n + 1; i++) tree[curr][i] = 0ll;
    for (int p = 1; p < n + 1; p++) {
      if (p == b)
        tree[curr][p] = tree[curr][p - 1];
      else {
        long long d = max(p - b, b - p) - 1, lo = max(1ll, p - d),
                  hi = min(n, p + d),
                  val = mod(tree[curr ^ 1][hi] + tree[curr ^ 1][p - 1] +
                            1000000007ll - tree[curr ^ 1][p] + 1000000007ll -
                            tree[curr ^ 1][lo - 1]);
        tree[curr][p] = mod(tree[curr][p - 1] + val);
      }
    }
  }
  printf("%d\n", mod(tree[curr ^ 1][a] + 1000000007ll - tree[curr ^ 1][a - 1]));
}
