#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > dp(5005, vector<long long>(5005, 0));
int main() {
  ios_base::sync_with_stdio(false);
  int n, a, b, k, p;
  long long sum;
  cin >> n >> a >> b >> k;
  dp[a][0] = 1;
  for (int i = 1; i <= n; i++) dp[i][0] = dp[i][0] + dp[i - 1][0];
  for (int j = 1; j <= k; j++) {
    for (int i = 1; i <= n; i++) {
      if (i > b) {
        p = (b + i) / 2 + 1;
        sum = (dp[n][j - 1] - dp[p - 1][j - 1]);
        if (i >= p) sum = sum - (dp[i][j - 1] - dp[i - 1][j - 1]);
        dp[i][j] = sum % 1000000007;
      } else if (i < b) {
        p = (int)ceil((b + i) / 2.0) - 1;
        sum = dp[p][j - 1];
        if (i <= p) sum = sum - (dp[i][j - 1] - dp[i - 1][j - 1]);
        dp[i][j] = sum % 1000000007;
      }
      dp[i][j] = dp[i][j] + dp[i - 1][j];
    }
  }
  long long cnt = 0;
  cout << dp[n][k] % 1000000007;
}
