#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  long long n, a, b, k;
  cin >> n >> a >> b >> k;
  --a, --b;
  long long* arr = new long long[n]{};
  long long* sum = new long long[n + 1]{};
  arr[a] = 1;
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + arr[i - 1];
  while (k--) {
    long long* t = new long long[n];
    for (int i = 0; i < n; i++) {
      long long x = (abs(b - i) - 1) / 2;
      if (i < b)
        t[i] = (sum[min(n, i + x + 1)] - sum[0] - arr[i] + 2 * MOD) % MOD;
      else if (i > b)
        t[i] = (sum[n] - sum[max(0LL, i - x)] - arr[i] + 2 * MOD) % MOD;
      else
        t[i] = 0LL;
    }
    delete[] arr;
    arr = t;
    for (int i = 1; i <= n; i++) sum[i] = (sum[i - 1] + arr[i - 1]) % MOD;
  }
  cout << sum[n];
  return 0;
}
