#include <bits/stdc++.h>
using namespace std;
template <class T>
inline int size(const T& c) {
  return c.size();
}
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const int cmod = 1000000007;
const int maxn = 5000 + 10;
int n, a, b, k;
long long F[maxn][maxn];
long long s[maxn];
int main() {
  scanf("%d%d%d%d", &n, &a, &b, &k);
  F[0][a] = 1;
  for (int j = 1; j <= n; j++) {
    s[j] = (s[j - 1] + F[0][j]) % cmod;
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      if (j != b) {
        if (j < b) {
          F[i][j] = (s[(b + j - 1) / 2] - F[i - 1][j]) % cmod;
        } else {
          F[i][j] = ((s[n] - s[(b + j) / 2]) % cmod - F[i - 1][j]) % cmod;
        }
      }
    }
    for (int j = 1; j <= n; j++) {
      s[j] = (s[j - 1] + F[i][j]) % cmod;
    }
  }
  cout << (s[n] % cmod + cmod) % cmod << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
