#include <bits/stdc++.h>
using namespace std;
long long n, b, memo[5002][5002];
long long absval(long long a) { return a > 0 ? a : -a; }
long long modset(long long res) {
  while (res >= 1000000007) res -= 1000000007;
  while (res < 0) res += 1000000007;
  return res;
}
int main() {
  long long a, k, i, j, dist;
  cin >> n >> a >> b >> k;
  for (j = 0; j <= k; j++) memo[0][j] = 0;
  for (i = 1; i <= n; i++) memo[i][0] = memo[i - 1][0] + 1;
  for (j = 1; j < k; j++) {
    for (i = 1; i <= n; i++) {
      dist = absval(i - b);
      memo[i][j] = modset((memo[i - 1][j] + memo[min(n, i + dist - 1)][j - 1] -
                           memo[max(i - dist, 0LL)][j - 1] - memo[i][j - 1] +
                           memo[i - 1][j - 1]));
    }
  }
  dist = absval(a - b);
  cout << modset(memo[min(n, a + dist - 1)][k - 1] -
                 memo[max(a - dist, 0LL)][k - 1] - memo[a][k - 1] +
                 memo[a - 1][k - 1])
       << "\n";
  return 0;
}
