#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
int getint() {
  int r = 0, k = 1;
  char c = getchar();
  for (; '0' > c || c > '9'; c = getchar())
    if (c == '-') k = -1;
  for (; '0' <= c && c <= '9'; c = getchar()) r = r * 10 - '0' + c;
  return r * k;
}
int n, a, b, t;
char str[1200006];
int otn[1200006], nto[1200006];
int watch(int pos) {
  if (str[pos] == 'h') return 1;
  return b + 1;
}
int cal(int l, int r) {
  if (l == r) return watch(l);
  int leftlen = n + 1 - l, rightlen = r - n - 1;
  return otn[r] + nto[l] - watch(n + 1) +
         (min(leftlen, rightlen) * 2 + max(leftlen, rightlen)) * a;
}
bool check(int x) {
  int ret = INF;
  for (int i = n + 1, j = n + x; j >= n + 1; --i, --j) {
    ret = min(ret, cal(i, j));
  }
  return ret <= t;
}
int main() {
  n = getint();
  a = getint();
  b = getint();
  t = getint();
  scanf("%s", str + 1);
  for (int i = 1; i <= n; ++i) str[i + n] = str[i];
  nto[1 + n] = otn[1 + n] = watch(1 + n);
  for (int i = n + 1; i <= n + n; ++i) otn[i] = otn[i - 1] + watch(i);
  for (int i = n; i >= 1; --i) nto[i] = nto[i + 1] + watch(i);
  int l = 0, r = n, mid;
  while (l < r) {
    mid = (l + r + 1) >> 1;
    if (check(mid))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d", l);
}
