#include <bits/stdc++.h>
using namespace std;
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = (0); i < (n); ++i) sum += v[i];
  return sum;
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
int main() {
  int n, a, b, k;
  cin >> n >> a >> b >> k;
  --a;
  --b;
  vector<vector<long long>> v(k + 1, vector<long long>(n));
  v[0][a] = 1;
  for (int i = (1); i < (k + 1); ++i) {
    vector<long long> s(n + 1);
    s[0] = 0;
    for (int j = (0); j < (n); ++j) {
      s[j + 1] = s[j] + v[i - 1][j];
    }
    for (int j = (0); j < (n); ++j) {
      if (j == b) continue;
      int l, r;
      if (j < b) {
        l = 0;
        r = min(n - 1, j + (b - j - 1) / 2);
      } else {
        l = max(0, j - (j - b - 1) / 2);
        r = n - 1;
      }
      v[i][j] = (((s[r + 1] - s[l] - v[i - 1][j]) % 1000000007) + 1000000007) %
                1000000007;
    }
  }
  long long res = 0;
  for (int j = (0); j < (n); ++j) {
    res = (res + v[k][j]) % 1000000007;
  }
  cout << res;
}
