#include <bits/stdc++.h>
using namespace std;
long long dp[2][5050];
long long dps[2][5050];
int main() {
  ios::sync_with_stdio(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  for (int i = 0; i <= n; i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++)
    dps[0][i] = (dps[0][i] + dps[0][i - 1] + dp[0][i]) % 1000000007;
  for (int k1 = 1; k1 <= k; k1++) {
    int r1 = k1 % 2;
    int r2 = !r1;
    for (int i = 1; i <= n; i++) {
      int h = abs(b - i);
      h--;
      dp[r1][i] = ((((dps[r2][min(h + i, n)] - dps[r2][max(i - h - 1, 0)]) %
                     1000000007) +
                    1000000007) %
                   1000000007);
      dp[r1][i] = (((dp[r1][i] - dp[r2][i]) % 1000000007) + 1000000007);
      dp[r1][i] %= 1000000007;
    }
    for (int i = 1; i <= n; i++) dps[r1][i] = 0;
    for (int i = 1; i <= n; i++)
      dps[r1][i] = (dps[r1][i] + dps[r1][i - 1] + dp[r1][i]) % 1000000007;
  }
  cout << dp[k % 2][a];
  return 0;
}
