#include <bits/stdc++.h>
using namespace std;
int dp[5001][5001];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  if (a > b) {
    a = n - a + 1;
    b = n - b + 1;
  }
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j < b; j++) {
      int lower = max(1, j - (b - j - 1));
      dp[i][lower] += dp[i - 1][j];
      dp[i][lower] %= 1000000007;
    }
    int current = 0;
    for (int j = 1; j < b; j++) {
      current += dp[i][j];
      current %= 1000000007;
      dp[i][j] = current + 1000000007 - dp[i - 1][j];
      dp[i][j] %= 1000000007;
    }
  }
  int answer = 0;
  for (int i = 1; i < b; i++) {
    answer += dp[k][i];
    answer %= 1000000007;
  }
  cout << answer << endl;
  return 0;
}
