#include <bits/stdc++.h>
using namespace std;
int n, a, b, k;
unsigned int f[5001][5001];
unsigned int MOD = 1e9 + 7;
unsigned int s[5001][5001];
unsigned int getSum(int, int, int);
int main() {
  cin >> n >> a >> b >> k;
  f[0][a] = 1;
  for (int i = a; i <= n; i++) {
    s[0][i] = 1;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j == b) {
        f[i][j] = 0;
      } else if (j > b) {
        f[i][j] = (getSum(i - 1, (j + b) / 2 + 1, n) + MOD - f[i - 1][j]) % MOD;
      } else if (j < b) {
        f[i][j] = (getSum(i - 1, 1, (b + j) / 2 - (1 - (b + j) % 2)) + MOD -
                   f[i - 1][j]) %
                  MOD;
      }
      s[i][j] = (s[i][j - 1] + f[i][j]) % MOD;
    }
  }
  unsigned int res = 0;
  for (int j = 1; j <= n; j++) {
    res = (res + f[k][j]) % MOD;
  }
  cout << res << endl;
  return 0;
}
unsigned int getSum(int i, int x, int y) {
  if (x > y) {
    return 0;
  }
  y = min(y, n);
  unsigned int valy = s[i][y];
  unsigned int valx = 0;
  if (x - 1 >= 0) {
    valx = s[i][x - 1];
  }
  return (valy + MOD - valx) % MOD;
}
