#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const int INF = (int)1e9;
const int N = (int)5e3 + 5;
const long long M = (int)1e9 + 7;
long long d[N][N], s[N];
pair<int, int> a[N];
int main() {
  int n, st, b, k;
  cin >> n >> st >> b >> k;
  d[0][st] = 1;
  for (int i = 1; i <= n; i++) {
    a[i].first = INF, a[i].second = -1;
    for (int j = 1; j <= n; j++)
      if (abs(j - i) < abs(j - b))
        a[i].first = min(a[i].first, j), a[i].second = max(a[i].second, j);
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) s[j] = (s[j - 1] + d[i - 1][j]) % M;
    for (int j = 1; j <= n; j++)
      if (j != b)
        d[i][j] =
            ((d[i][j] + s[a[j].second] - s[a[j].first - 1] - d[i - 1][j]) % M +
             M) %
            M;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + d[k][i]) % M;
  cout << ans;
  return 0;
}
