#include <bits/stdc++.h>
using namespace std;
int dp[5015][5015];
int main() {
  ios::sync_with_stdio(false);
  int i, j, n, a, b, k;
  cin >> n >> a >> b >> k;
  if (b < a) {
    a = n - a + 1;
    b = n - b + 1;
  }
  for (i = 1; i <= b - 1; ++i) dp[1][i] = 1;
  for (i = 2; i <= k + 1; ++i) {
    int cur = 0;
    int pre = 1;
    for (j = 1; j <= b - 1; ++j) {
      cur = (cur + dp[i - 1][j]) % 1000000007;
    }
    for (j = 1; j <= b - 1; ++j) {
      while (abs(j - pre) >= abs(j - b)) {
        cur = (cur - dp[i - 1][pre] + 1000000007) % 1000000007;
        pre++;
      }
      dp[i][j] = (cur - dp[i - 1][j] + 1000000007) % 1000000007;
    }
  }
  for (i = 1; i <= k + 1; ++i) {
    for (j = 1; j <= b - 1; ++j) {
    }
  }
  cout << dp[k + 1][a] % 1000000007;
  return 0;
}
