#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int move;
  cin >> move;
  int change;
  cin >> change;
  int total;
  cin >> total;
  string s;
  cin >> s;
  vector<bool> ori(n);
  for (int i = 0; i < n; i++) ori[i] = (s[i] == 'h');
  int res = 0;
  int total2 = total;
  if (!ori[0]) total2 -= change;
  total2--;
  if (total2 < 0) return res;
  res = 1;
  vector<int> r(n), l(r);
  r[0] = 0;
  l[0] = 0;
  int total3 = total2;
  int start = 0;
  while (total3 > 0) {
    start = (start + n - 1) % n;
    int cost = move;
    if (!ori[start]) cost += change;
    cost++;
    l[start] = cost + l[(start + 1) % n];
    total3 -= cost;
    if (start == 0) {
      cout << n;
      return 0;
    }
  }
  for (int i = 1; i < n; i++)
    if (l[i] == 0) l[i] = INT_MAX;
  total3 = total2;
  start = 0;
  while (total3 > 0) {
    start = (start + 1) % n;
    int cost = move;
    if (!ori[start]) cost += change;
    cost++;
    r[start] = cost + r[(start - 1 + n) % n];
    total3 -= cost;
  }
  for (int i = 1; i < n; i++)
    if (r[i] == 0) r[i] = INT_MAX;
  int left = 0, right = 0;
  total3 = total2;
  start = 0;
  while (total3 > 0) {
    start = (start + n - 1) % n;
    int cost = move;
    if (!ori[start]) cost += change;
    cost++;
    total3 -= cost;
    left = start;
    int total4 = total3 - (right + n - left) % n * move;
    int k = 0;
    while (k < n && total4 >= r[k]) k++;
    res = max(res, (k + n - left) % n + 1);
  }
  left = 0;
  right = 0;
  total3 = total2;
  start = 0;
  while (total3 > 0) {
    start = (start + n + 1) % n;
    int cost = move;
    if (!ori[start]) cost += change;
    cost++;
    total3 -= cost;
    right = start;
    int total4 = total3 - (right + n - left) % n * move;
    int k = 0;
    while (total4 >= r[k]) {
      k--;
      if (k < 0) k += n;
    }
    res = max(res, (right + n - k) % n + 1);
  }
  cout << res;
  return 0;
}
