#include <bits/stdc++.h>
using namespace std;
int n, a, b, k;
long long dp[3][5005], sum;
int main() {
  scanf("%d %d %d %d", &n, &a, &b, &k);
  if (a > b) {
    a = n + 1 - a;
    b = n + 1 - b;
  }
  memset(dp, 0, sizeof(dp));
  dp[0][a] = 1;
  for (int i = 1; i <= k; i++) {
    sum = 0;
    for (int j = 1; j <= b / 2; j++)
      sum = (sum + dp[(i - 1) % 3][j]) % 1000000007;
    int ind = b / 2;
    for (int j = 1; j < b; j++) {
      if (j > 1 && (b - j) % 2 == 1)
        sum = (sum + dp[(i - 1) % 3][++ind]) % 1000000007;
      dp[i % 3][j] =
          ((sum - dp[(i - 1) % 3][j]) % 1000000007 + 1000000007) % 1000000007;
    }
  }
  long long ans = 0;
  for (int i = 1; i < b; i++) ans = (ans + dp[k % 3][i]) % 1000000007;
  printf("%I64d\n", ans);
  return 0;
}
