#include <bits/stdc++.h>
using namespace std;
long long dp[5005][5005], sum[5005], n, k, x, b, ans, null;
long long absol(long long v) {
  if (v < 0) return v * -1;
  return v;
}
int main() {
  cin >> n >> x >> b >> k;
  dp[x][0] = 1;
  for (int v = 1; v <= k; v++) {
    for (int i = 1; i <= n; i++)
      sum[i] = (sum[i - 1] + dp[i][v - 1] + 1000000007) % 1000000007;
    for (int y = 1; y <= n; y++) {
      if (y == b) continue;
      if (y < b) {
        dp[y][v] += sum[y + (b - y + 1) / 2 - 1];
        dp[y][v] = (dp[y][v] + 1000000007) % 1000000007;
        dp[y][v] -= (dp[y][v - 1] + 1000000007) % 1000000007;
      } else {
        dp[y][v] = sum[n] - sum[y - (y - b + 1) / 2];
        dp[y][v] = (dp[y][v] + 1000000007) % 1000000007;
        dp[y][v] -= (dp[y][v - 1] + 1000000007) % 1000000007;
      }
    }
    for (int i = 0; i <= n; i++) sum[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    ans += (dp[i][k] + 1000000007) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
