#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
const double E = 2.71828;
int n, a, b, k;
int t[5005][5005];
int sum;
void inc(int id, int x, int val) {
  t[id][x] += val;
  if (t[id][x] >= mod) t[id][x] -= mod;
}
int go(int id, int x) {
  sum += t[id][x];
  if (sum >= mod) sum -= mod;
  return sum;
}
void process(int id) {
  sum = 0;
  if (a < b) {
    for (int i = 1; i < b; ++i) {
      int val = go(id - 1, i);
      int diff = abs(i - b);
      int l = max(1, i - diff + 1);
      int r = min(b - 1, i + diff - 1);
      inc(id, l, val);
      inc(id, r + 1, mod - val);
      inc(id, i, mod - val);
      inc(id, i + 1, val);
    }
  } else {
    for (int i = b + 1; i <= n; ++i) {
      int val = go(id - 1, i);
      int diff = abs(i - b);
      int l = max(b + 1, i - diff + 1);
      int r = min(n, i + diff - 1);
      inc(id, l, val);
      inc(id, r + 1, mod - val);
      inc(id, i, mod - val);
      inc(id, i + 1, val);
    }
  }
}
int main(void) {
  scanf("%d %d %d %d", &n, &a, &b, &k);
  inc(0, a, 1);
  inc(0, a + 1, mod - 1);
  for (int i = 1; i <= k; ++i) {
    process(i);
  }
  int res = 0;
  sum = 0;
  for (int i = 1; i <= n; ++i) {
    res += go(k, i);
    if (res >= mod) {
      res -= mod;
    }
  }
  printf("%d\n", res);
  return 0;
}
