#include <bits/stdc++.h>
using namespace std;
const int maxN = 5010;
const long long oo = 1000000000 + 7;
int n, a, b, k;
long long f[maxN][maxN];
long long sum(int x, int i, int j) {
  if (i <= 0) i = 1;
  if (j > n) j = n;
  if (i > j) return 0;
  return (f[x][j] - f[x][i - 1] + oo) % oo;
}
int main() {
  ios ::sync_with_stdio(false);
  cin >> n >> a >> b >> k;
  for (int i = (a), _b = (n); i <= _b; i++) f[0][i] = 1;
  for (int j = (1), _b = (k); j <= _b; j++)
    for (int i = (1), _b = (n); i <= _b; i++) {
      if (i > b)
        f[j][i] = sum(j - 1, i + 1, n) + sum(j - 1, i - (i - b - 1) / 2, i - 1);
      else if (i < b)
        f[j][i] = sum(j - 1, 1, i - 1) + sum(j - 1, i + 1, i + (b - i - 1) / 2);
      f[j][i] %= oo;
      f[j][i] += f[j][i - 1];
      f[j][i] %= oo;
    }
  long long res = f[k][n];
  cout << res << endl;
  return 0;
}
