#include <bits/stdc++.h>
using namespace std;
const int MAX = 1111111;
const int inf = 1000000001;
const int cmod = 1000000007;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, 1, -1, 0};
int n, a, b, k;
int f[5555][5555];
int _add[5555];
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &k);
  f[0][a] = 1;
  for (int i = 0; i < k; i++) {
    for (int j = 1; j <= n; j++) _add[j] = 0;
    for (int j = 1; j <= n; j++) {
      if (j == b) continue;
      int l, r;
      if (j < b) {
        r = b - 1;
        l = j - (r - j);
      } else {
        l = b + 1;
        r = j + (j - l);
      }
      l = max(l, 1);
      r = min(r, n);
      _add[l] += f[i][j];
      _add[j] -= f[i][j];
      _add[j + 1] += f[i][j];
      _add[r + 1] -= f[i][j];
      _add[l] %= cmod;
      _add[r + 1] %= cmod;
      _add[j + 1] %= cmod;
      _add[j] %= cmod;
    }
    int x = 0;
    for (int j = 1; j <= n; j++) {
      x += _add[j];
      x %= cmod;
      if (x < 0) x += cmod;
      f[i + 1][j] = x;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i == b) continue;
    ans += f[k][i];
    ans %= cmod;
  }
  printf("%d\n", ans);
  return 0;
}
