#include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 1e9 + 4;
template <typename T>
inline bool chkmax(T& aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
template <class T>
T extgcd(T a, T b, T& x, T& y) {
  for (T u = y = 1, v = x = 0; a;) {
    T q = b / a;
    swap(x -= q * u, u);
    swap(y -= q * v, v);
    swap(b -= q * a, a);
  }
  return b;
}
template <class T>
T mod_inv(T a, T m) {
  T x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}
long long n, a, b, t;
const long long mn = 5e5 + 2;
char s[mn];
long long pre[2 * mn];
long long getsum(long long x, long long k) { return pre[x + k] - pre[x]; }
long long solve(long long k) {
  if (k == 0) return 0;
  long long best = INF;
  for (long long s = n - k + 1; s <= n; s++) {
    long long l = n - s, r = s + k - 1 - n;
    long long lo = min(l, r), hi = max(l, r);
    long long m = lo * 2 + hi;
    long long numh = getsum(s, k);
    long long cand = k + (k - numh) * b + m * a;
    chkmin(best, cand);
  }
  return best;
}
int main() {
  scanf("%lld%lld%lld%lld\n", &n, &a, &b, &t);
  scanf("%s", s);
  pre[0] = 0;
  for (long long i = 0; i <= 2 * n; i++) {
    pre[i + 1] = pre[i] + ((s[i % n] == 'h') ? 1 : 0);
  }
  long long imin = 0, imax = n + 1;
  while (imin < imax) {
    long long imid = (imin + imax) / 2;
    long long got = solve(imid);
    if (got <= t)
      imin = imid + 1;
    else
      imax = imid;
  }
  long long ans = imin - 1;
  printf("%lld\n", ans);
}
