#include <bits/stdc++.h>
using namespace std;
int dp[2][(5005)];
int main() {
  int N, A, B, K;
  cin >> N >> A >> B >> K;
  if (B < A) {
    A = N - A + 1;
    B = N - B + 1;
  }
  dp[0][A] = 1;
  int pre = 0;
  int now = 1;
  for (int k = 1; k <= K; k++) {
    for (int j = 1; j <= N; j++) dp[now][j] = 0;
    int bot = 1;
    int sum = 0;
    int top = -1;
    for (int i = bot;; i++) {
      if (i - 1 >= B - i) break;
      top = i;
      sum = (sum + dp[pre][i]) % (1000000007);
    }
    for (int i = 1; i < B; i++) {
      dp[now][i] = (sum - dp[pre][i] + (1000000007)) % (1000000007);
      int nx = i + 1;
      if (top + 1 < B && top + 1 - nx < B - top - 1) {
        top++;
        sum = (sum + dp[pre][top]) % (1000000007);
      }
    }
    pre ^= 1;
    now ^= 1;
  }
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    ans = (ans + dp[pre][i]) % (1000000007);
  }
  printf("%d\n", ans);
  return 0;
}
