#include <bits/stdc++.h>
using namespace std;
long long dp[5500][5500];
long long sum[5500];
int main(int argc, char const *argv[]) {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  dp[0][a] = 1;
  if (a < b) {
    for (int i = 1; i <= k; i++) {
      sum[0] = 0;
      for (int j = 1; j <= b; j++) {
        sum[j] = sum[j - 1] + dp[i - 1][j];
        if (sum[j] >= 1000000007) sum[j] -= 1000000007;
      }
      for (int j = 1; j < b; j++) {
        int l = 1;
        int r = (j - 1 + b) / 2;
        dp[i][j] = sum[r] - sum[l - 1] + 1000000007;
        if (dp[i][j] >= 1000000007) dp[i][j] -= 1000000007;
        dp[i][j] -= dp[i - 1][j];
        dp[i][j] += 1000000007;
        if (dp[i][j] >= 1000000007) dp[i][j] -= 1000000007;
      }
    }
  } else {
    for (int i = 1; i <= k; i++) {
      sum[b] = 0;
      for (int j = b + 1; j <= n; j++) {
        sum[j] = sum[j - 1] + dp[i - 1][j];
        if (sum[j] >= 1000000007) sum[j] -= 1000000007;
      }
      for (int j = b + 1; j <= n; j++) {
        int l = (j + 1 + b + 1) / 2;
        int r = n;
        dp[i][j] = sum[r] - sum[l - 1] + 1000000007;
        if (dp[i][j] >= 1000000007) dp[i][j] -= 1000000007;
        dp[i][j] -= dp[i - 1][j];
        dp[i][j] += 1000000007;
        if (dp[i][j] >= 1000000007) dp[i][j] -= 1000000007;
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[k][i];
    if (ans >= 1000000007) ans -= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
