#include <bits/stdc++.h>
using namespace std;
int n, m, j, p, l, r, x, y, k1, k2, k3, k4, k, i, w, rez, b;
int a, dp[5005][5005], c[5005][5005];
int Abs(int x) {
  if (x < 0) return -x;
  return x;
}
int main() {
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  for (j = 0; j < k; j++) {
    for (i = 1; i <= n; i++)
      if (i != b) {
        x = Abs(b - i) - 1;
        l = max(1, i - x);
        r = min(n, i + x);
        c[j + 1][l] += dp[j][i];
        c[j + 1][l] %= 1000000007;
        c[j + 1][r + 1] -= dp[j][i];
        c[j + 1][r + 1] += 1000000007;
        c[j + 1][r + 1] %= 1000000007;
        dp[j + 1][i] -= dp[j][i];
        dp[j + 1][i] += 1000000007;
        dp[j + 1][i] %= 1000000007;
      }
    long long tmp = 0;
    for (i = 1; i <= n; i++) {
      tmp += c[j + 1][i];
      tmp %= 1000000007;
      dp[j + 1][i] += tmp;
      dp[j + 1][i] %= 1000000007;
    }
  }
  long long sum = 0;
  for (i = 1; i <= n; i++) {
    sum += dp[k][i];
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
