#include <bits/stdc++.h>
using namespace std;
long long dp[2][5000 + 10], ans[5000 + 10], *dp1, *dp2;
int n, a, b, k, curdp;
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  if (a > b) {
    b = n - b + 1;
    a = n - a + 1;
  }
  ans[0] = dp[0][0] = dp[1][0] = 0;
  for (int i = 1; i < b; ++i) {
    ans[i] = 1;
    dp[0][i] = i;
  }
  dp1 = dp[0];
  dp2 = dp[1];
  for (int i = 0; i < k; ++i) {
    for (int j = 1; j < b; ++j) {
      ans[j] = dp1[b - 1] - dp1[max(0, 2 * j - b)] - ans[j];
      while (ans[j] < 0) {
        ans[j] += 1000000007;
      }
      while (ans[j] >= 1000000007) ans[j] -= 1000000007;
      dp2[j] = dp2[j - 1] + ans[j];
      while (dp2[j] < 0) {
        dp2[j] += 1000000007;
      }
      while (dp2[j] >= 1000000007) dp2[j] -= 1000000007;
    }
    swap(dp1, dp2);
  }
  printf("%I64d\n", ans[a]);
  return 0;
}
