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