#include <bits/stdc++.h>
using namespace std;
const long MOD = 1000000007;
long long n, k, a, b, f1[2 * 5005], f2[2 * 5005];
bool flag = true;
inline void print(long long l, long long s) {
  cout << "print:" << s << endl;
  for (int i = 0; i <= l; i++) {
    cout << f1[i] << ',' << f2[i] << endl;
    if (f1[i] < 0 || f2[i] < 0) {
      cout << ' ' << f1[2 * i - 2] << ' ' << f1[2 * i - 1] << endl;
      system("pause");
    }
  }
}
inline void mod(long long* x) {
  while (*x >= MOD) {
    *x -= MOD;
  }
  while (*x < 0) {
    *x += MOD;
  }
}
inline long long f(int x) { return flag ? f1[x] : f2[x]; }
inline void fadd(int i, long long v) {
  if (flag) {
    f2[i] = f2[i - 1] + v;
    mod(f2 + i);
  } else {
    f1[i] = f1[i - 1] + v;
    mod(f1 + i);
  }
}
int process(long long l, long long x, long long s) {
  memset(f1, 0, sizeof(f1));
  memset(f2, 0, sizeof(f2));
  f2[1] = 1;
  for (int i = 2; i <= l; i++) {
    fadd(i, 0);
  }
  flag = !flag;
  for (int i = 1; i <= s; i++) {
    for (int j = 2; j <= l; j++) {
      fadd(j, f(j - 1) - f(j) + f(2 * j - 2) + f(2 * j - 1));
    }
    if (i == 1) {
      f2[1] = 0;
    }
    flag = !flag;
  }
  return f(x);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> a >> b >> k;
  int ans;
  if (a > b) {
    ans = process(n - b, a - b, k);
  } else {
    ans = process(b - 1, b - a, k);
  }
  cout << ans;
}
