#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k, a, b;
  cin >> n >> a >> b >> k;
  a -= 1;
  b -= 1;
  long long** d = new long long*[k + 1];
  for (int i = 0; i <= k; i++) {
    d[i] = new long long[n];
    for (int j = 0; j < n; j++) d[i][j] = 0;
  }
  d[0][a] = 1;
  if (a < b) {
    for (int i = 0; i < k; i++) {
      d[i + 1][b - 1] = 0;
      for (int l = b - 2; l >= 0; l--) d[i + 1][b - 1] += d[i][l];
      for (int l = b - 2; l >= 0; l--) {
        d[i + 1][l] = d[i + 1][l + 1] - d[i][l] + d[i][l + 1] -
                      ((((l + b) % 2) == 0) ? d[i][(l + b) / 2] : 0);
        d[i + 1][l] = (d[i + 1][l] + 1000000007) % 1000000007;
      }
    }
    long long res = 0;
    for (int i = 0; i < n; i++) {
      res += d[k][i];
      res = (res + 1000000007) % 1000000007;
    }
    cout << res << "\n";
  } else {
    for (int i = 0; i < k; i++) {
      d[i + 1][b + 1] = 0;
      for (int l = b + 2; l < n; l++) d[i + 1][b + 1] += d[i][l];
      for (int l = b + 2; l < n; l++) {
        d[i + 1][l] = d[i + 1][l - 1] - d[i][l] + d[i][l - 1] -
                      ((((l + b) % 2) == 0) ? d[i][(l + b) / 2] : 0);
        d[i + 1][l] = (d[i + 1][l] + 1000000007) % 1000000007;
      }
    }
    long long res = 0;
    for (int i = 0; i < n; i++) {
      res += d[k][i];
      res = (res + 1000000007) % 1000000007;
    }
    cout << res << "\n";
  }
  return 0;
}
