#include <bits/stdc++.h>
using namespace std;
long long dp[2][5010];
long long sum[2][5010];
int a, b, n, k;
int main() {
  while (scanf("%d%d%d%d", &n, &a, &b, &k) != EOF) {
    memset(dp, 0, sizeof(dp));
    memset(sum, 0, sizeof(sum));
    dp[0][a] = 1;
    for (int i = a; i <= n; ++i) sum[0][i] = 1;
    for (int i = 1; i <= k; ++i)
      for (int j = 1; j <= n; ++j) {
        if (j < b) {
          int tem = (b + j) / 2;
          if ((b + j) % 2 == 0) --tem;
          dp[i % 2][j] =
              (sum[(i + 1) % 2][tem] - dp[(i + 1) % 2][j] + 1000000007) %
              1000000007;
        } else if (j > b)
          dp[i % 2][j] = (sum[(i + 1) % 2][n] - sum[(i + 1) % 2][(j + b) / 2] -
                          dp[(i + 1) % 2][j] + 1000000007) %
                         1000000007;
        sum[i % 2][j] =
            (sum[i % 2][j - 1] + dp[i % 2][j] + 1000000007) % 1000000007;
      }
    cout << (sum[k % 2][n] + 1000000007) % 1000000007 << endl;
  }
  return 0;
}
