#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int inc(int j, int n)
{
	j++;
	if(j==n) j = 0;
	return j;
}

int dec(int j, int n)
{
	j--;
	if(j<0) j = n - 1;
	return j;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	for (int i = 0; i < n; i++)
	{
		if (l != 0)
		{
			t += a + 1;
			if (s[i-1] == 'w') t += b;
			l--;
		}
		p = 0;
		while (p <= t)
		{
			if (s[r] == 'w')
			{
				p = b + 1;
			}
			else p = 1;
			if (p + a <= t)
			{
				t -= p + a;
				r = inc(r,n);
				l++;
				if (l == n)
				{
					cout << n;
					return 0;
				}
				p = 0;
			}
			else
			{
				if (p <= t)
				{
					m = max(l+ 1, m);
					if (m == n)
					{
						cout << m;
						return 0;
					}
					break;
				}
				else
				{
					m = max(l, m);
					if (m == n)
					{
						cout << m;
						return 0;
					}
				}
			}
		}
	}

	l = 0, r = n-1, p = 0;
	t = h;
	for (int i = n-1; i >=0; i--)
	{
		if (l != 0)
		{
			t += a + 1;
			if (s[i+1] == 'w') t += b;
			l--;
		}
		p = 0;
		while (p <= t)
		{
			if (s[r] == 'w')
			{
				p = b + 1;
			}
			else p = 1;
			if (p + a <= t)
			{
				t -= p + a;
				r = dec(r, n);
				l++;
				if (l == n)
				{
					cout << n;
					return 0;
				}
				p = 0;
			}
			else
			{
				if (p <= t)
				{
					m = max(l + 1, m);
					if (m == n)
					{
						cout << m;
						return 0;
					}
					break;
				}
				else
				{
					m = max(l, m);
					if (m == n)
					{
						cout << m;
						return 0;
					}
				}
			}
		}
	}
	cout << m;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int inc(int j, int n)
{
	j++;
	if(j==n) j = 0;
	return j;
}

int dec(int j, int n)
{
	j--;
	if(j<0) j = n - 1;
	return j;
}

int binsearch(int t, int l, int r,const vector<int> & x)
{
	int m = (r + l) / 2;
	if (t > x[m])
	{
		return binsearch(t, l, m - 1, x);
	}
	if (t < x[m])
	{
		if (t >= x[m + 1]) return m + 1;
		return binsearch(t, m+1, r, x);
	}
	if (t == x[m])
	{
		return m;
	}
}

int binsearch1(int t, int l, int r, const vector<int> & x)
{
	int m = (r + l) / 2;
	if (t > x[m])
	{
		return binsearch(t, m+1, r, x);
	}
	if (t < x[m])
	{
		if (t >= x[m -1]) return m - 1;
		return binsearch(t, l, m-1, x);
	}
	if (t == x[m])
	{
		return m;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'w')
		{
			x[i] = b + 1;
		}
		else
		{
			x[i] = 1;
		}
	}
	vector<int> y(n), z(n);
	z[0] = y[0] = 0;
	if (t < x[0])
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		y[i] = y[i - 1] + x[i] + a;
	}
	for (int i = n - 1; i > 0; i--)
	{
		int j = (i + 1) % n;
		z[i] = z[j] + a + x[i];
	}
	m = 1;
	t -= x[0];
	for (int i = 1; i < n; i++)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= i*a)
		{
			p = t - i*a;
			if (p >= z[i + 1])
			{
				cout << n;
				return 0;
			}
			if (p >= z[n - 1])
			{
				int k = binsearch(p, i + 1, n - 1, z);
				m = max(i + 1 + n - k, m);
			}
			else
			{
				m = max(m, i + 1);
			}
		}
		else
		{
			m = max(m, i + 1);
		}
	}
	t = h - x[0];
	for (int i = n - 1; i > 0; i--)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= (n-i)*a)
		{
			p = t - (n-i)*a;
			if (p >= y[i - 1])
			{
				cout << n;
				return 0;
			}
			if (p >= y[1])
			{
				int k = binsearch1(p, 1, i - 1, y);
				m = max(n - i + 1 +  k, m);
			}
			else
			{
				m = max(m, n - i + 1);
			}
		}
		else
		{
			m = max(m, n - i + 1);
		}
	}
	cout << m;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'w')
		{
			x[i] = b;
		}
		else
		{
			x[i] = 1;
		}
	}
	vector<ll> y(n), z(n);
	z[0] = y[0] = 0;
	if (t < x[0])
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		y[i] = y[i - 1] + x[i] + a;
	}
	for (int i = n - 1; i > 0; i--)
	{
		int j = (i + 1) % n;
		z[i] = z[j] + a + x[i];
	}
	m = 1;
	t -= x[0];
	r = 1;
	for (int i = 1; i < n; i++)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= i*a)
		{
			p = t - i*a;
			if (p >= z[i + 1])
			{
				cout << n;
				return 0;
			}
			while ((r < n) && (p < z[r])) r++;
			if (r < n)
			{
				m = max(i + 1 + n - r, m);
			}
		}
		else
		{
			m = max(m, i + 1);
		}
	}
	t = h - x[0];
	r = 1;
	for (int i = n - 1; i > 0; i--)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= (n-i)*a)
		{
			p = t - (n-i)*a;
			if (p >= y[i - 1])
			{
				cout << n;
				return 0;
			}
			while ((r < i) && (p < y[r])) r++;
			if (r < i)
			{
				m = max(r + n - i + 1, m);
			}
		}
		else
		{
			m = max(m, n - i + 1);
		}
	}
	cout << m;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int inc(int j, int n)
{
	j++;
	if(j==n) j = 0;
	return j;
}

int dec(int j, int n)
{
	j--;
	if(j<0) j = n - 1;
	return j;
}

int binsearch(int t, int l, int r,const vector<int> & x)
{
	int m = (r + l) / 2;
	if (t > x[m])
	{
		return binsearch(t, l, m - 1, x);
	}
	if (t < x[m])
	{
		if (t >= x[m + 1]) return m + 1;
		return binsearch(t, m+1, r, x);
	}
	if (t == x[m])
	{
		return m;
	}
}

int binsearch1(int t, int l, int r, const vector<int> & x)
{
	int m = (r + l) / 2;
	if (t > x[m])
	{
		return binsearch(t, m+1, r, x);
	}
	if (t < x[m])
	{
		if (t >= x[m -1]) return m - 1;
		return binsearch(t, l, m-1, x);
	}
	if (t == x[m])
	{
		return m;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'w')
		{
			x[i] = b + 1;
		}
		else
		{
			x[i] = 1;
		}
	}
	vector<int> y(n), z(n);
	z[0] = y[0] = 0;
	if (t < x[0])
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		y[i] = y[i - 1] + x[i] + a;
	}
	for (int i = n - 1; i > 0; i--)
	{
		int j = (i + 1) % n;
		z[i] = z[j] + a + x[i];
	}
	m = 1;
	t -= x[0];
	r = 1;
	for (int i = 1; i < n; i++)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= i*a)
		{
			p = t - i*a;
			if (p >= z[i + 1])
			{
				cout << n;
				return 0;
			}
			while ((r < n) && (p < z[r])) r++;
			if (r < n)
			{
				m = max(i + 1 + n - r, m);
			}
		}
		else
		{
			m = max(m, i + 1);
		}
	}
	t = h - x[0];
	r = 1;
	for (int i = n - 1; i > 0; i--)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= (n-i)*a)
		{
			p = t - (n-i)*a;
			if (p >= y[i - 1])
			{
				cout << n;
				return 0;
			}
			while ((r < i) && (p < y[r])) r++;
			if (r < i)
			{
				m = max(r + n - i + 1, m);
			}
		}
		else
		{
			m = max(m, n - i + 1);
		}
	}
	cout << m;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'w')
		{
			x[i] = b + 1;
		}
		else
		{
			x[i] = 1;
		}
	}
	vector<ll> y(n), z(n);
	z[0] = y[0] = 0;
	if (t < x[0])
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		y[i] = y[i - 1] + x[i] + a;
	}
	for (int i = n - 1; i > 0; i--)
	{
		int j = (i + 1) % n;
		z[i] = z[j] + a + x[i];
	}
	m = 1;
	t -= x[0];
	r = 1;
	for (int i = 1; i < n; i++)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= i*a)
		{
			p = t - i*a;
			if (p >= z[i + 1])
			{
				cout << n;
				return 0;
			}
			while ((r < n) && (p < z[r])) r++;
			if (r < n)
			{
				m = max(i + 1 + n - r, m);
			}
		}
		else
		{
			m = max(m, i + 1);
		}
	}
	t = h - x[0];
	r = n-1;
	for (int i = n - 1; i > 0; i--)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= (n-i)*a)
		{
			p = t - (n-i)*a;
			if (p >= y[i - 1])
			{
				cout << n;
				return 0;
			}
			while ((r > 0) && (p < y[r])) r--;
			if (r > 0)
			{
				m = max(r + n - i + 1, m);
			}
		}
		else
		{
			m = max(m, n - i + 1);
		}
	}
	cout << m;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<cstdio>
#include<utility>
#include<math.h>

#define ll long long
#define MAXN 100100
#define ost 1000000007;
#define _USE_MATH_DEFINES

using namespace std;

struct point
{
	ll x;
	ll y;
	point(ll a = 0, ll b = 0){
		x = a;
		y = b;
	}
};

double sqr(double a){ return a*a; }

bool cmp(ll a, ll b){
	return a<b;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, a, b, t, h, p, l, r, m = 0;
	cin >> n >> a >> b >> t;
	h = t;
	string s;
	cin >> s;
	l = 0;
	r = 0;
	p = 0;
	vector<int> x(n);
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'w')
		{
			x[i] = b + 1;
		}
		else
		{
			x[i] = 1;
		}
	}
	vector<ll> y(n), z(n);
	z[0] = y[0] = 0;
	if (t < x[0])
	{
		cout << 0;
		return 0;
	}
	for (int i = 1; i < n; i++)
	{
		y[i] = y[i - 1] + x[i] + a;
	}
	for (int i = n - 1; i > 0; i--)
	{
		int j = (i + 1) % n;
		z[i] = z[j] + a + x[i];
	}
	m = 1;
	t -= x[0];
	r = 1;
	for (int i = 1; i < n; i++)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= i*a)
		{
			p = t - i*a;
			if (p >= z[i + 1])
			{
				cout << n;
				return 0;
			}
			while ((r < n) && (p < z[r])) r++;
			if (r < n)
			{
				m = max(i + 1 + n - r, m);
			}
		}
		else
		{
			m = max(m, i + 1);
		}
	}
	t = h - x[0];
	r = 1;
	for (int i = n - 1; i > 0; i--)
	{
		if (t>=x[i] + a)
		{
			t -= (x[i] + a);
		}
		else
		{
			break;
		}
		if (t >= (n-i)*a)
		{
			p = t - (n-i)*a;
			if (p >= y[i - 1])
			{
				cout << n;
				return 0;
			}
			while ((r < i) && (p < y[r])) r++;
			if (r < i)
			{
				m = max(r + n - i + 1, m);
			}
		}
		else
		{
			m = max(m, n - i + 1);
		}
	}
	cout << m;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;
	int p1 = mp;
	int p2 = ms;

	p2 = n - 1;
	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] - dd + (a + 1)*min(p1,p2) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] - dd + (a + 1)*p2 <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
//cout<<c<<' ';
		m[i] = (c == 'w');
//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;;
		if (suf[i] <= t)ms = i;
	}
if (mp == -1 && ms==-1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;
	int p1 = mp;
	int p2 = ms;

p2=n-1;
	while (p1 > 0 )
	{
		while (p2>=0&&p1<p2 && pref[p1] + suf[p2] - dd + (a + 1)*p1<=t)--p2;
++p2;
//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;
	int d;
	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
		{
			pref[i] = 0;d = 1 + m[i] * b;
		}
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	//int dd = 1 + m[0] * b;
	suf[n] = 0;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;

	int p1 = mp;
	int p2 = ms;

	p2 = n;

	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] + d + a*(min(p1 + 1, n - p2)) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] + d + a*(min(p1 + 1, n - p2)) <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
//cout<<c<<' ';
		m[i] = (c == 'w');
//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
if (mp == -1 && ms==-1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;
	int p1 = mp;
	int p2 = ms;

p2=n-1;
	while (p1 > 0 )
	{
		while (p2>=0&&p1<p2 && pref[p1] + suf[p2] - dd + (a + 1)*p1<=t)--p2;
++p2;
//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
p1=0;

	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;

	int p1 = mp;
	int p2 = ms;

	p2 = n - 1;
	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] - dd + a*(min(p1,p2)+1) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] - dd + a*(min(p1, p2) + 1) <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;
	int p1 = mp;
	int p2 = ms;

	p2 = n - 1;
	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] - dd + (a + 1)*p1 <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] - dd + (a + 1)*p2 <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;
	int d;
	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
		{
			pref[i] = 0;d = 1 + m[i] * b;
		}
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (d+pref[i] <= t)mp = i;
	}
	//int dd = 1 + m[0] * b;
	suf[n] = 0;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (d+suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;

	int p1 = mp;
	int p2 = ms;

	p2 = n;
//forn(i,n)cout<<pref[i]<<' '<<suf[i]<<'\n';
	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] + d + a*(min(p1 , n - p2)) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] + d + a*(min(p1 , n - p2)) <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;
	int d;
	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
		{
			pref[i] = 0;d = 1 + m[i] * b;
		}
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (d+pref[i] <= t)mp = i;
	}
	//int dd = 1 + m[0] * b;
	suf[n] = 0;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (d+suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;

	int p1 = mp;
	int p2 = ms;

	p2 = n;

	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] + d + a*(min(p1 + 1, n - p2)) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] + d + a*(min(p1 + 1, n - p2)) <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#define _CRT_SECURE_NO_WARNINGS
#include<math.h>
#include<map>
#include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<stdio.h>
#include<set>
#include<vector>

#define forn(i,n) for(long long i=0;i<n;++i)
#define rforn(i,n) for(long long i=n-1;i>=0;--i)

using namespace std;

//#define TEST_RUN

int n, k;
#define out(a) {cout<<a;return 0;}

int kil[1000006];

int a[1000006];

int lll(int a, int b)
{
	int c = a;
	int d = b;
	while (c&&d)
	{
		c %= d;
		if (c)d %= c;
	}
	return a / (c + d)*b;
}

#define LL long long

int m[500005];
int pref[500005];
int suf[500005];

int main()
{
#ifdef TEST_RUN
	double start_time = clock();
	//freopen("intput.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int n, a, b, t;
	cin >> n >> a >> b >> t;
	char c;
	cin.get();
	int pos = 0;
	int mr = 0;
	int mp = -1;int ms = -1;

	forn(i, n)
	{
		scanf("%c", &c);
		//cout<<c<<' ';
		m[i] = (c == 'w');
		//cout<<m[i]<<' ';
		if (i == 0)
			pref[i] = 1 + m[i] * b;
		else
			pref[i] = pref[i - 1] + 1 + m[i] * b + a;

		if (pref[i] <= t)mp = i;
	}
	int dd = 1 + m[0] * b;
	suf[n] = dd;dd+=a;
	rforn(i, n)
	{
		suf[i] = suf[i + 1] + 1 + m[i] * b + a;
		if (suf[i] <= t)ms = i;
	}
	if (mp == -1 && ms == -1)out(0);
	if (mp == -1)out(n - ms);
	if (ms == -1)out(mp + 1);
	mr = max(n - ms, mp + 1);
	int cr;

	int p1 = mp;
	int p2 = ms;

	p2 = n ;

	while (p1 > 0)
	{
		while (p2 >= 0 && p1<p2 && pref[p1] + suf[p2] - dd + a*(min(p1+1,n-p2)) <= t)--p2;
		++p2;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		--p1;
	}
	p1 = 0;
	p2 = ms;
	while (p2 < n)
	{
		while (p1 < n && p1 < p2 && pref[p1] + suf[p2] - dd + a*(min(p1+1, n-p2)) <= t)++p1;
		--p1;
		//cout<<p1<<' '<<p2<<'\n';
		cr = p1 + 1 + n - p2;
		mr = max(mr, cr);
		++p2;
	}
	cout << mr;
#ifdef TEST_RUN
	printf("\nRun time is %.2lf\n", (clock() - start_time) / CLOCKS_PER_SEC);
	system("pause");
#endif
}


#pragma comment(linker, "/STACK:30777216")
#include<string>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include <cmath>
#include <queue>
using namespace std;

#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define li long long
#define eps 0.00000001
#define pi_2     1.57079632679489661923
li n,k,m,p,d,a,b,t;
li mod = 1000000007;
li f(string &s)
{
	li anss = 0;
	vector <li> pref;
	pref.resize(s.size());
	for(int i = n; i < s.size(); i++)
	{
		if(i == n)
		{
			pref[i] += 1 + (s[i] == 'w') * b;
			continue;
		}
		pref[i] = pref[i-1] + a + 1 + (s[i] == 'w') * b;
	}
	for(int i = n-1; i > 0; i--)
	{
		pref[i] = (i < n-1) * pref[i + 1] + 1 + (s[i] == 'w') * b + a;
	}
	li ans = 0, l_ind = 1, r_ind = n, time = pref[1] + pref[n];
	while(1)
	{
		if(l_ind >= n || r_ind >= 2*n)
			break;
		while(time > t && l_ind < n)
		{
			time -= (1 + a + (s[l_ind] == 'w') * b);
			l_ind ++;
		}
		while(time <= t && r_ind < 2*n)
		{
			r_ind ++;
			if(r_ind == 2*n)
				continue;
			time += (1 + 2 * a + (s[r_ind] == 'w') * b);
		}
		anss = max(anss, r_ind - l_ind);
	}
	return anss;
}
int main ()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> a >> b >> t;
	string s;
	cin >> s;
	if(n == 1)
	{
		cout << (b*(s[0] == 'w') + 1);
		return 0;
	}
	string ss = s + s;

	string r_ss = "";
	r_ss += s[0];
	reverse(all(s));
	r_ss += (s + s);
	r_ss.resize(2*n);
	li t1 = f(ss);
	li t2 = f(r_ss);
	cout << min(max(t1, t2), n);
	return 0;
}


#pragma comment(linker, "/STACK:30777216")
#include<string>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include <cmath>
#include <queue>
using namespace std;

#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define li long long
#define eps 0.00000001
#define pi_2     1.57079632679489661923
li n,k,m,p,d,a,b,t;
li mod = 1000000007;
li f(string &s)
{
	li anss = 0;
	vector <li> pref;
	pref.resize(s.size());
	for(int i = n; i < s.size(); i++)
	{
		if(i == n)
		{
			pref[i] += 1 + (s[i] == 'w') * b;
			continue;
		}
		pref[i] = pref[i-1] + a + 1 + (s[i] == 'w') * b;
	}
	for(int i = n-1; i > 0; i--)
	{
		pref[i] = (i < n-1) * pref[i + 1] + 1 + (s[i] == 'w') * b + a;
	}
	li ans = 0, l_ind = 1, r_ind = n, time = pref[1] + pref[n];
	while(1)
	{
		if(l_ind >= n || r_ind >= 2*n)
			break;
		while(time > t && l_ind < n)
		{
			time -= (1 + a + (s[l_ind] == 'w') * b);
			l_ind ++;
		}
		while(time <= t && r_ind < 2*n)
		{
			r_ind ++;
			if(r_ind == 2*n)
				continue;
			time += (1 + 2 * a + (s[r_ind] == 'w') * b);
		}
		anss = max(anss, r_ind - l_ind);
	}
	return anss;
}
int main ()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> a >> b >> t;
	string s;
	cin >> s;
	if(n == 1)
	{
		cout << (b*(s[0] == 'w') + 1) < t;
		return 0;
	}
	string ss = s + s;

	string r_ss = "";
	r_ss += s[0];
	reverse(all(s));
	r_ss += (s + s);
	r_ss.resize(2*n);
	li t1 = f(ss);
	li t2 = f(r_ss);
	cout << min(max(t1, t2), n);
	return 0;
}


#pragma comment(linker, "/STACK:30777216")
#include<string>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include <cmath>
#include <queue>
using namespace std;

#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define li long long
#define eps 0.00000001
#define pi_2     1.57079632679489661923
li n,k,m,p,d,a,b,t;
li mod = 1000000007;
li f(string &s)
{
	li anss = 0;
	vector <li> pref;
	pref.resize(s.size());
	for(int i = n; i < s.size(); i++)
	{
		if(i == n)
		{
			pref[i] += 1 + (s[i] == 'w') * b;
			continue;
		}
		pref[i] = pref[i-1] + a + 1 + (s[i] == 'w') * b;
	}
	for(int i = n-1; i > 0; i--)
	{
		pref[i] = (i < n-1) * pref[i + 1] + 1 + (s[i] == 'w') * b + a;
	}
	li ans = 0, l_ind = 1, r_ind = n, time = pref[1] + pref[n];
	while(1)
	{
		if(l_ind >= n || r_ind >= 2*n)
			break;
		while(time > t && l_ind < n)
		{
			time -= (1 + a + (s[l_ind] == 'w') * b);
			l_ind ++;
		}
		while(time <= t && r_ind < 2*n)
		{
			r_ind ++;
			if(r_ind == 2*n)
				continue;
			time += (1 + 2 * a + (s[r_ind] == 'w') * b);
		}
		anss = max(anss, r_ind - l_ind);
	}
	return anss;
}
int main ()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> a >> b >> t;
	string s;
	cin >> s;
	if(n == 1)
	{
		cout << ((b*(s[0] == 'w') + 1) <= t);
		return 0;
	}
	string ss = s + s;

	string r_ss = "";
	r_ss += s[0];
	reverse(all(s));
	r_ss += (s + s);
	r_ss.resize(2*n);
	li t1 = f(ss);
	li t2 = f(r_ss);
	cout << min(max(t1, t2), n);
	return 0;
}


#pragma comment(linker, "/STACK:30777216")
#include<string>
#include<string.h>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include <cmath>
#include <queue>
using namespace std;

#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define li long long
#define eps 0.00000001
#define pi_2     1.57079632679489661923
li n,k,m,p,d,a,b,t;
li mod = 1000000007;
li f(string &s)
{
	li anss = 0;
	vector <li> pref;
	pref.resize(s.size());
	for(int i = n; i < s.size(); i++)
	{
		if(i == n)
		{
			pref[i] += 1 + (s[i] == 'w') * b;
			continue;
		}
		pref[i] = pref[i-1] + a + 1 + (s[i] == 'w') * b;
	}
	for(int i = n-1; i > 0; i--)
	{
		pref[i] = (i < n-1) * pref[i + 1] + 1 + (s[i] == 'w') * b + a;
	}
	li ans = 0, l_ind = 1, r_ind = n, time = pref[1] + pref[n];
	while(1)
	{
		if(l_ind >= n || r_ind >= 2*n)
			break;
		while(time > t && l_ind < n)
		{
			time -= (1 + a + (s[l_ind] == 'w') * b);
			l_ind ++;
		}
		while(time <= t && r_ind < 2*n)
		{
			time += (1 + 2 * a + (s[l_ind] == 'w') * b);
			r_ind ++;
		}
		anss = max(anss, r_ind - l_ind);
	}
	return anss;
}
int main ()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n >> a >> b >> t;
	string s;
	cin >> s;
	string ss = s + s;
	reverse(all(s));
	string r_ss = s + s;
	cout << min(max(f(ss), f(r_ss)), n);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;

li calc() {
	for (int i = 0; i < N; i++) {
		suf[i] = pref[i] = 0;
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
//	cout << pref[4] << endl;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) continue;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}
	//cout << ans;
	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) > time) continue;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n - 1, time) - pref - 1;
	//	cout << idx << endl;
		idx = min(idx, len);
		idx = max(idx, 0);
		//cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	//	cout << ans << " " << idx + 2 + i << endl;
	}
	return ans;
}

li trial() {
	//return 5;
	li ans = 0;
	li time = 0;
	for (int i = 0; i < n; i++) {
		if (i) time += aa;
		time++;
		if (a[i] == 'w') time += bb;
		//cout << time << " " << i + 1 << endl;
		if (time <= T) ans = max(ans, li(i + 1));
		else break;
		int cnt = 0;
		li tt = time;
		for (int j = 1; j < n; j++) {
			time += aa;
			if (n + i - j == i) break;
			if (i - j < 0) {
				cnt++;
				if (a[n + i - j] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(cnt + i + 1));
		}
		time = tt;
	}

	time = 0;
	time++;
	if (a[0] == 'w') time += bb;
	for (int i = n - 1; i >= 0; i--) {
		time += aa;
		if (a[i] == 'w') time += bb;
		time++;
		if (time <= T) ans = max(ans, li(n - i));
		else break;
		li tt = time;
		int idx = i + 1;
		int cnt = 0;
		while (idx - n != i) {
			time += aa;
			if (idx > n) {
				cnt++;
				if (a[idx - n] == 'w') time += bb;
				time++;
			}
			idx++;
			if (time > T) break;
			ans = max(ans, li(n - i + cnt));
		}
		time = tt;
	}
	return ans;
}
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	/*int cnt = 0;
	for (n = 9; n < 10; n++) {
		for (T = 3; T < 10; T++) {
			for (aa = 1; aa < 10; aa++) {
				for (bb = 1; bb < 10; bb++) {
					for (int j = 0; j < 50; j++) {
						for (int i = 0; i < n; i++) {
							if ((j & (1 << i)) != 0) {
								a[i] = 'w';
							}
							else a[i] = 'h';
						}
						cout << cnt << endl;
						cnt++;
						if (trial() != calc()) {
							cout << aa << " " << bb << " " << trial() << " " << calc() << endl;
							cout << n << " " << T << endl;
							for (int i = 0; i < n; i++) {
								cout << a[i];
							}
							return 0;
						}
					}
				}
			}
		}
	}*/
	printf("%I64d", calc());
	//cout << trial() << " " << calc();
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 2);
		int len = n - i - 1;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 1);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(pref, pref + n, time) - pref;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;

li calc() {
	for (int i = 0; i < N; i++) {
		suf[i] = pref[i] = 0;
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) > time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n - 1, time) - pref - 1;
		idx = min(idx, len);
		idx = max(idx, 0);
		//cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	return ans;
}

li trial() {
	li ans = 0;
	li time = 0;
	for (int i = 0; i < n; i++) {
		if (i) time += aa;
		time++;
		if (a[i] == 'w') time += bb;
		if (time <= T) ans = max(ans, li(i + 1));
		else break;
		int cnt = 0;
		li tt = time;
		for (int j = 1; j < n; j++) {
			time += aa;
			if (n - i + j == i) break;
			if (i - j < 0) {
				cnt++;
				if (a[n - i + j] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(cnt + i + 1));
		}
		time = tt;
	}

	time = 0;
	time++;
	if (a[0] == 'w') time += bb;
	for (int i = n - 1; i >= 0; i--) {
		time += aa;
		if (a[i] == 'w') time += bb;
		if (time <= T) ans = max(ans, li(i + 1));
		else break;
		li tt = time;
		int idx = i + 1;
		int cnt = 0;
		while (idx - n != i) {
			time += aa;
			if (idx > n) {
				cnt++;
				if (a[idx - n] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(n - i + cnt));
		}
	}
	return ans;
}
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	printf("%I64d", trial());
	//cout << trial() << " " << calc();
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 1);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(pref, pref + n, time) - pref;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
		idx = max(idx, 0);
 //cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 1);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(pref, pref + n, time) - pref;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;

li calc() {
	for (int i = 0; i < N; i++) {
		suf[i] = pref[i] = 0;
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}
	//cout << ans;
	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) > time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n - 1, time) - pref - 1;
	//	cout << idx << endl;
		idx = min(idx, len);
		idx = max(idx, 0);
		//cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	//	cout << ans << " " << idx + 2 + i << endl;
	}
	return ans;
}

li trial() {
	//return 5;
	li ans = 0;
	li time = 0;
	for (int i = 0; i < n; i++) {
		if (i) time += aa;
		time++;
		if (a[i] == 'w') time += bb;
		//cout << time << " " << i + 1 << endl;
		if (time <= T) ans = max(ans, li(i + 1));
		else break;
		int cnt = 0;
		li tt = time;
		for (int j = 1; j < n; j++) {
			time += aa;
			if (n + i - j == i) break;
			if (i - j < 0) {
				cnt++;
				if (a[n + i - j] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(cnt + i + 1));
		}
		time = tt;
	}

	time = 0;
	time++;
	if (a[0] == 'w') time += bb;
	for (int i = n - 1; i >= 0; i--) {
		time += aa;
		if (a[i] == 'w') time += bb;
		time++;
		if (time <= T) ans = max(ans, li(n - i));
		else break;
		li tt = time;
		int idx = i + 1;
		int cnt = 0;
		while (idx - n != i) {
			time += aa;
			if (idx > n) {
				cnt++;
				if (a[idx - n] == 'w') time += bb;
				time++;
			}
			idx++;
			if (time > T) break;
			ans = max(ans, li(n - i + cnt));
		}
		time = tt;
	}
	return ans;
}
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	int cnt = 0;
	/*for (n = 9; n < 10; n++) {
		for (T = 3; T < 10; T++) {
			for (aa = 1; aa < 10; aa++) {
				for (bb = 1; bb < 10; bb++) {
					for (int j = 0; j < 50; j++) {
						for (int i = 0; i < n; i++) {
							if ((j & (1 << i)) != 0) {
								a[i] = 'w';
							}
							else a[i] = 'h';
						}
						cout << cnt << endl;
						cnt++;
						if (trial() != calc()) {
							cout << aa << " " << bb << " " << trial() << " " << calc() << endl;
							cout << n << " " << T << endl;
							for (int i = 0; i < n; i++) {
								cout << a[i];
							}
							return 0;
						}
					}
				}
			}
		}
	}*/
	printf("%I64d", calc());
	//cout << trial() << " " << calc();
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n -1 , time) - pref - 1;
		idx = min(idx, len);
		idx = max(idx, 0);
 //cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
 //cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 2);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
 		cout << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 1);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 1;
		int idx = upper_bound(pref, pref + n, time) - pref;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 1);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 2);
		int len = n - i - 1;
		int idx = upper_bound(pref, pref + n, time) - pref;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 2);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;

li calc() {
	for (int i = 0; i < N; i++) {
		suf[i] = pref[i] = 0;
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 1) > time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n - 1, time) - pref - 1;
		idx = min(idx, len);
		idx = max(idx, 0);
		//cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	return ans;
}

li trial() {
	li ans = 0;
	li time = 0;
	for (int i = 0; i < n; i++) {
		if (i) time += aa;
		time++;
		if (a[i] == 'w') time += bb;
		if (time <= T) ans = max(ans, li(i + 1));
		else break;
		int cnt = 0;
		li tt = time;
		for (int j = 1; j < n; j++) {
			time += aa;
			if (n + i - j == i) break;
			if (i - j < 0) {
				cnt++;
				if (a[n + i - j] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(cnt + i + 1));
		}
		time = tt;
	}

	time = 0;
	time++;
	if (a[0] == 'w') time += bb;
	for (int i = n - 1; i >= 0; i--) {
		time += aa;
		if (a[i] == 'w') time += bb;
		if (time <= T) ans = max(ans, li(n - i));
		else break;
		li tt = time;
		int idx = i + 1;
		int cnt = 0;
		while (idx - n != i) {
			time += aa;
			if (idx > n) {
				cnt++;
				if (a[idx - n] == 'w') time += bb;
				time++;
			}
			if (time > T) break;
			ans = max(ans, li(n - i + cnt));
		}
	}
	return ans;
}
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	printf("%I64d", trial());
	//cout << trial() << " " << calc();
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 2);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
 	//cout << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

const int N = 5e5 + 100;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 100;
#define mp(x, y) make_pair(x, y)
#define pb(x) push_back(x)
typedef long long li;

int n;

char a[N];
li suf[N];
li pref[N];
li aa, bb, T;
int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	scanf("%d", &n);
	scanf("%I64d %I64d %I64d", &aa, &bb, &T);
	for (int i = 0; i < n; i++) {
		scanf(" %c", &a[i]);
	}
	suf[0] = aa + 1;
	if (a[n - 1] == 'w') suf[0] += bb;
	pref[0] = 1;
	if (a[0] == 'w') pref[0] += bb;

	for (int i = 1; i < n; i++) {
		pref[i] = pref[i - 1];
		pref[i] += aa;
		if (a[i] == 'w') pref[i] += bb;
		pref[i]++;
	}

	for (int i = 1; i < n; i++) {
		suf[i] = suf[i - 1];
		int idx = n - 1 - i;
		suf[i] += aa;
		if (a[idx] == 'w') {
			suf[i] += bb;
		}
		suf[i]++;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (T >= pref[i]) ans = max(ans, i + 1);
		else break;
		li time = T - pref[i];
		if (aa * (i) >= time) break;

		time = time - aa * (i);
		int len = n - i - 1;
		int idx = upper_bound(suf, suf + n, time) - suf;
		idx = min(idx, len);
		//cout << len << " " << idx << " " << ans << i + 1 + idx << endl;
		ans = max(ans, i + 1 + idx);
	}

	suf[0] += pref[0];
	for (int i = 1; i < n; i++) {
		pref[i] -= pref[0];
	}
	pref[0] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (T >= suf[i]) ans = max(ans, i + 2);
		else break;
		li time = T - suf[i];
		if (aa * (i + 2) >= time) break;

		time = time - aa * (i + 1);
		int len = n - i - 2;
		int idx = upper_bound(pref + 1, pref + n, time) - pref - 1;
		idx = min(idx, len);
 //cout <<time << " " << idx << " " << len << " " << i + 2 + idx << " " << ans << endl;
		ans = max(ans, i + 2 + idx);
	}
	printf("%d", ans);
	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;

int main()  {
	int n,a,b,t;
	cin >> n >> a >> b >> t;

	string s;
	cin >> s;

	vector<long long> left(n);
	long long cur = 0;
	for( int i = 0; i < n-1; i++ ) {
		cur += a + 1 + b*(s[n-1-i] == 'w');
		left[i] = cur;
	}

	vector<long long> right(n);
	cur = 0;
	for( int i = 0; i < n-1; i++ ) {
		cur += a + 1 + b*(s[i+1] == 'w');
		right[i] = cur;
	}

	int ans = 0;
	if( 1 + b*(s[0] == 'w') > t ) {
		cout << ans;
		return 0;
	}

	ans = 1;
	t -= 1+b*(s[0] == 'w');

	int subAns = 1;
	int edge = n-2;
	while( edge >= 0 && right[edge] > t ) {
		edge--;
	}
	if( edge >= 0 )
		subAns +=edge + 1;

	for( int i = 0; i <n-1; i++ ) {
		int temp = left[i] + (i+1)*a;
		while( edge >= 0 && (temp + right[edge] > t || edge + i >= n-2) )
			edge --;
		subAns = max(subAns, (edge>=0 && temp+right[edge] <= t)*(1 + max(edge,0) + i + 2));
	}

	ans = max(ans,subAns);

	subAns = 1;
	edge = n-2;
	while( edge >= 0 && left[edge] > t ) {
		edge--;
	}
	if( edge >= 0 )
		subAns +=edge + 1;
	for( int i = 0; i < n-1; i++ ) {
		int temp = right[i] + (i+1)*a;
		while( edge >= 0 && (temp + left[edge] > t || edge + i >= n-2) )
			edge --;
		subAns = max(subAns, (edge>=0 && temp+left[edge] <= t)*(1 + max(edge,0) + i + 2));
	}
	ans = max(ans,subAns);

	cout << ans;

	return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <limits>
#include <iomanip>

using namespace std;

int main()  {
	int n,a,b,t;
	cin >> n >> a >> b >> t;

	string s;
	cin >> s;

	vector<long long> left(n);
	long long cur = 0;
	for( int i = 0; i < n-1; i++ ) {
		cur += a + 1 + b*(s[n-1-i] == 'w');
		left[i] = cur;
	}

	vector<long long> right(n);
	cur = 0;
	for( int i = 0; i < n-1; i++ ) {
		cur += a + 1 + b*(s[i+1] == 'w');
		right[i] = cur;
	}

	int ans = 0;
	if( 1 + b*(s[0] == 'w') > t ) {
		cout << ans;
		return 0;
	}

	ans = 1;
	t -= 1+b*(s[0] == 'w');

	int subAns = 1;
	int edge = n-2;
	while( edge > 0 && right[edge] > t ) {
		edge--;
	}
	if( edge >= 0 )
		subAns +=edge + 1;

	for( int i = 0; i <n-1; i++ ) {
		int temp = left[i] + (i+1)*a;
		while( edge >= 0 && (temp + right[edge] > t || edge + i >= n-2) )
			edge --;
		subAns = max(subAns, (edge>=0 && temp+right[edge] <= t)*(1 + max(edge,0) + i + 2));
	}

	ans = max(ans,subAns);

	subAns = 1;
	edge = n-2;
	while( edge > 0 && left[edge] > t ) {
		edge--;
	}
	if( edge >= 0 )
		subAns +=edge + 1;
	for( int i = 0; i < n-1; i++ ) {
		int temp = right[i] + (i+1)*a;
		while( edge >= 0 && (temp + left[edge] > t || edge + i >= n-2) )
			edge --;
		subAns = max(subAns, (edge>=0 && temp+left[edge] <= t)*(1 + max(edge,0) + i + 2));
	}
	ans = max(ans,subAns);

	cout << ans;

	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cstring>

using namespace std;

#define mp make_pair
#define pp push_back
#define Sort(x) sort(x.begin(), x.end())
#define rep(i, x, y) for(int i = x; i < y; ++i)
#define Rep(i, x, y) for(int i = x; i <= y; ++i)
#define dRep(i, x, y) for(int i = x;i >= y; --i)
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long
#define all(v) v.begin(),v.end()
#define ii pair<int, int>
#define mem(x, v) memset(x, v, sizeof(x))
#define nl '\n'
#define MOD 1000000007
#define readFile freopen("input.in", "r", stdin)

ll n, toMove, toRotate, allTime;
string orientation;
int main()
{
	//readFile;
	while(cin >> n >> toMove >> toRotate >> allTime >> orientation)
	{
		int sz;
		ll curTime = 0;
		ll res = 0;
		int last = n;
		orientation += orientation;
		rep(i, orientation.size() / 2, orientation.size())
		{
			if(orientation[i] == 'w')
			{
				curTime += 1 + toRotate;
			}
			else
			{
				curTime ++;
			}
			if(curTime + toMove * (i - orientation.size() / 2) <= allTime)
				last++;
			else
			{
				curTime--;
				if(orientation[i] == 'w')
					curTime -= toRotate;
				break;
			}
		}
		res = last - n;
		if(res == n)
		{
			cout << n << nl;
			continue;
		}
		ll i2 = orientation.size() / 2;
		for(ll i = last - 1; i >= orientation.size() / 2; i--)
		{
			while(curTime + min(toMove * (i - orientation.size() / 2) + 2 * toMove * (orientation.size() / 2 - i2),toMove * (orientation.size() / 2 - i2) + 2 * toMove * (i - orientation.size() / 2)) <= allTime)
			{
				//added
				i2--;
				if(orientation[i2] == 'w')
					curTime += toRotate;
				curTime++;
				res = max(res, i - i2);
			}

			//removed
			curTime--;
			if(orientation[i] == 'w')
				curTime -= toRotate;
		}
		cout << res << nl;
	}

	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cstring>

using namespace std;

#define mp make_pair
#define pp push_back
#define Sort(x) sort(x.begin(), x.end())
#define rep(i, x, y) for(int i = x; i < y; ++i)
#define Rep(i, x, y) for(int i = x; i <= y; ++i)
#define dRep(i, x, y) for(int i = x;i >= y; --i)
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long
#define all(v) v.begin(),v.end()
#define ii pair<int, int>
#define mem(x, v) memset(x, v, sizeof(x))
#define nl '\n'
#define MOD 1000000007
#define readFile freopen("input.in", "r", stdin)

ll n, toMove, toRotate, allTime;
string orientation;
int main()
{
	//readFile;
	while(cin >> n >> toMove >> toRotate >> allTime >> orientation)
	{
		int sz;
		ll curTime = 0;
		ll res = 0;
		int last = n;
		orientation += orientation;
		rep(i, orientation.size() / 2, orientation.size())
		{
			if(orientation[i] == 'w')
			{
				curTime += 1 + toRotate;
			}
			else
			{
				curTime ++;
			}
			if(curTime + toMove * (i - orientation.size() / 2) <= allTime)
				last++;
			else
			{
				curTime--;
				if(orientation[i] == 'w')
					curTime -= toRotate;
				break;
			}
		}
		/*if(last == n)
		{
			cout << n << nl;
			return 0;
		}*/
		res = last - n;
		if(res == n)
		{
			cout << n << nl;
			continue;
		}
		ll i2 = orientation.size() / 2;
		for(ll i = last - 1; i >= orientation.size() / 2; i--)
		{
			while(curTime + min(toMove * (i - orientation.size() / 2) + 2 * (orientation.size() / 2 - i2),toMove * (orientation.size() / 2 - i2) + 2 * (i - orientation.size() / 2)) <= allTime)
			{
				//added
				i2--;
				if(orientation[i2] == 'w')
					curTime += toRotate;
				curTime++;
				res = max(res, i - i2);
			}

			//removed
			curTime--;
			if(orientation[i] == 'w')
				curTime -= toRotate;
		}
		cout << res << nl;
	}

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define N 666666

using namespace std;
inline int read(){
	int ret=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while ('0'<=ch&&ch<='9'){
		ret=ret*10-48+ch;
		ch=getchar();
	}
	return ret;
}
inline char readch(){
	char ch=getchar();
	while (!isalpha(ch)) ch=getchar();
	return ch;
}

int n,a,b,t;
int claris[N];
int stk[N],top;

int main(){
	n=read();a=read();b=read();t=read();
	for (int i=1;i<=n;++i) claris[i]=(readch()=='w')*b+a+1;
	claris[1]-=a;
	top=0;
	int p=1,ans=0;
	while (p<=n&&claris[p]<=t)
		t-=(stk[top++]=claris[p++]);
	int now=ans=top,tmp;
	if (p>n){printf("%d\n",n);return 0;}
	p=n;
	while (top){
		while ((tmp=(n-p<top-1)*a+claris[p])<=t){
			t-=tmp;++now;--p;
		}
		ans=max(ans,now);
		t+=stk[--top];--now;
	}
	printf("%d\n",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define N 666666

using namespace std;
inline int read(){
	int ret=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while ('0'<=ch&&ch<='9'){
		ret=ret*10-48+ch;
		ch=getchar();
	}
	return ret;
}
inline char readch(){
	char ch=getchar();
	while (!isalpha(ch)) ch=getchar();
	return ch;
}

int n,a,b,t;
int claris[N];
int stk[N],top;

int main(){
	n=read();a=read();b=read();t=read();
	for (int i=1;i<=n;++i) claris[i]=(readch()=='w')*b+a+1;
	claris[1]-=a;
	top=0;
	int p=1,ans=0;
	while (p<=n&&claris[p]<=t)
		t-=(stk[top++]=claris[p++]);
	int now=ans=top,tmp;
	if (p>n){printf("%d\n",n);return 0;}
	p=n;
	while (top){
		while ((tmp=(n-p<top-1)*a+claris[p])<=t){
			t-=tmp;++now;--p;
		}
		ans=max(ans,now);
		t+=stk[--top];--now;
		if (n-p>top-1) t+=a;
	}
	printf("%d\n",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define N 666666

using namespace std;
inline int read(){
	int ret=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while ('0'<=ch&&ch<='9'){
		ret=ret*10-48+ch;
		ch=getchar();
	}
	return ret;
}
inline char readch(){
	char ch=getchar();
	while (!isalpha(ch)) ch=getchar();
	return ch;
}

int n,a,b,t;
int claris[N];
int stk[N],top;

int main(){
	n=read();a=read();b=read();t=read();
	for (int i=1;i<=n;++i) claris[i]=(readch()=='w')*b+a+1;
	claris[1]-=a;
	top=0;
	int p=1,ans=0;
	while (p<=n&&claris[p]<=t)
		t-=(stk[top++]=claris[p++]);
	int now=ans=top,tmp;
	if (p>n){printf("%d\n",n);return 0;}
	p=n;
	while (top>1){
		t+=stk[--top];--now;
		while ((tmp=(n-p<top-1)*a+claris[p])<=t){
			t-=tmp;++now;--p;
		}
		ans=max(ans,now);
	}
	printf("%d\n",ans);
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define N 666666

using namespace std;
inline int read(){
	int ret=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while ('0'<=ch&&ch<='9'){
		ret=ret*10-48+ch;
		ch=getchar();
	}
	return ret;
}
inline char readch(){
	char ch=getchar();
	while (!isalpha(ch)) ch=getchar();
	return ch;
}

int n,a,b,t;
int claris[N];
int stk[N],top;

int main(){
	n=read();a=read();b=read();t=read();
	for (int i=1;i<=n;++i) claris[i]=(readch()=='w')*b+a+1;
	claris[1]-=a;
	top=0;
	int p=1,ans=0;
	while (p<=n&&claris[p]<=t)
		t-=(stk[top++]=claris[p++]);
	int now=ans=top,tmp;
	if (p>n){printf("%d\n",n);return 0;}
	p=n;
	while (top){
		while ((tmp=(n-p<top-1)*a+claris[p])<=t){
			t-=tmp;++now;--p;
		}
		ans=max(ans,now);
		t+=stk[--top];--now;
		if (n-p>top-1) t-=a;
	}
	printf("%d\n",ans);
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <numeric>
#include <queue>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <iomanip>
#include <set>
#include <queue>
#include <bitset>
#include <iomanip>
#include <map>
#include <string.h>
#include <stack>
#include <algorithm>

#include <unordered_map>
#include <unordered_set>

using namespace std;

char input[500010];
long long sum1[500010];
long long sum2[500010];

int get_value(char ch , int b)
{
	int ans = 1;
	if (ch == 'w')
		ans += b;
	return ans;
}

long long get_time_1(int pos1 , int pos2 , int n , long long a)
{
	long long ans = sum1[pos1] + sum2[pos2];
	ans += pos1 * a * 2;
	ans += (n - pos2) * a;
	return ans;
}

long long get_time_2(int pos1 , int pos2 , int n , long long a)
{
	long long ans = sum1[pos2] + sum2[pos1];
	ans += (n - pos1) * a;
	ans += (n - pos1 - 1) * a;
	ans += (pos2 + 1) * a;
	return ans;
}

int main()
{
	int i , j , n;
	long long a , b , t;
	while (scanf("%d%I64d%I64d%I64d" , &n , &a , &b , &t) != EOF)
	{
		memset(sum1 , 0 , sizeof(sum1));
		memset(sum2 , 0 , sizeof(sum2));

		int ans = 0;

		scanf("%s" , input);
		for (i = 0;i < n;i ++)
		{
			if (i == 0)
				sum1[i] = get_value(input[i] , b);
			else
				sum1[i] = get_value(input[i] , b) + sum1[i - 1];
		}
		for (i = n - 1;i >= 0;i --)
		{
			if (i == n - 1)
				sum2[i] = get_value(input[i] , b);
			else
				sum2[i] = get_value(input[i] , b) + sum2[i + 1];
		}
		// 第一种情况，一直往右边搞
		int temp = 0;
		long long tot_time = 0;
		i = 0;
		while (i < n && tot_time <= t)
		{
			tot_time += get_value(input[i] , b);
			if (i > 0)
				tot_time += a;
			temp ++;
			i ++;
		}
		if (tot_time > t)
			temp --;
		if (temp > ans)
			ans = temp;
		// 第二种情况，一直往左边搞
		i = n - 1;
		tot_time = get_value(input[0] , b);
		temp = 1;
		while (i >= 1 && tot_time <= t)
		{
			tot_time += (get_value(input[i] , b) + a);
			temp ++;
			i --;
		}
		if (tot_time > t)
			temp --;
		if (temp > ans)
			ans = temp;
		// 第三种情况，往右边走到一个地方，然后往回搞
		for (i = 0;i < n - 1;i ++)
		{
			// 往右边搞到i
			int low = i + 1 , high = n - 1 , mid = 0;
			while (low <= high)
			{
				mid = low + (high - low) / 2;
				long long temp_time = get_time_1(i , mid , n , a);
				if (temp_time > t)
					low = mid + 1;
				else
					high = mid - 1;
			}
			mid = max(mid - 5 , i + 1);
			while (mid < n && get_time_1(i , mid , n , a) > t)
				mid ++;
			if (mid < n)
			{
				// i , mid
				temp = i + 1 + n - mid;
				if (temp > ans)
					ans = temp;
			}
		}
		// 第四种情况，先往左边搞，在搞回来
		for (i = n - 1;i >= 1;i --)
		{
			int low = 0 , high = i - 1 , mid = 0;
			while (low <= high)
			{
				mid = low + (high - low) / 2;
				long long temp_time = get_time_2(i , mid , n , a);
				if (temp_time > t)
					high = mid - 1;
				else
					low = mid + 1;
			}
			mid = min(mid + 5 , i - 1);
			while (mid >= 0 && get_time_2(i , mid , n , a) > t)
				mid --;
			if (mid >= 0)
			{
				temp = mid + 1 + n - i;
				if (temp > ans)
					ans = temp;
			}
		}
		printf("%d\n" , ans);
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <queue>
#include <algorithm>
#define N 500050
using namespace std;
int n,a,b,t;
char ma[N];
int sum[N];
int dsum[N];
int ans,maxx;

int main()
{
    int i,j;
    while(~scanf("%d%d%d%d",&n,&a,&b,&t)){
        scanf("%s",ma);
        memset(sum,0,sizeof(sum));

        if(ma[0]=='w')
            sum[0]=b+1;
        else sum[0]=1;
        for(i=1;i<n;i++){
            sum[i]=sum[i-1]+a+1;
            if(ma[i]=='w')
                sum[i]+=b;
        }

        if(ma[n-1]=='w')
            dsum[n-1]=a+b+1;
        else dsum[n-1]=a+1;
        for(i=n-2;i>=1;i--){
            dsum[i]=dsum[i+1]+a+1;
            if(ma[i]=='w')
                dsum[i]+=b;
        }

        if(sum[n-1]<=t){
            printf("%d\n",n);
            continue;
        }

        ans=0;
        for(i=0;i<n&&sum[i]<=t;i++){
            if(sum[i]+a*i<t){
                int left=i+1,right=n-1;
                int ans2=-1;
                while(left<=right){
                    int mid=(left+right)>>1;
                    if(sum[i]+a*i+dsum[mid]<=t){
                        ans2=mid;
                        right=mid-1;
                    }
                    else
                        left=mid+1;
                }
                if(ans2!=-1){
                    ans=max(i+1+n-ans2,ans);
                }
            }
            else{
                ans=max(ans,i+1);
            }
        }

        for(i=n-1;i>=1&&dsum[i]+sum[0]<=t;i--){
            if(dsum[i]+sum[0]+a*(n-i)<t){
                int left=1,right=i-1;
                int ans2=-1;
                while(left<=right){
                    int mid=(left+right)>>1;
                    if(dsum[i]+sum[mid]+a*(n-i)<=t){
                        ans2=mid;
                        left=mid+1;
                    }
                    else
                        right=mid-1;
                }
                if(ans2!=-1){
                    ans=max(n-i+ans2+1,ans);
                }
            }
            else{
                ans=max(ans,n-i+1);
            }
        }
        printf("%d\n",ans);

    }
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <map>
#include <algorithm>

#define lli long long int
#define ui unsigned long long int

using namespace std;

lli n, k, m, h1, h2, x, y, t;
string s;
int ql[1000000], qr[1000000];

int tme(int ind) {
	int v = 0;
	if (s[ind] == 'w')
		v += k;
	v++;
	return v;
}

int f(int lefttime, int cnt) {
	return qr[cnt] <= lefttime;
}

int f2(int lefttime, int cnt) {
	return ql[cnt] <= lefttime;
}

int main() {

	cin >> n >> m >> k >> t >> s;
	int ans = 0;

	ql[0] = 0;
	for (int i = 1; i < n; i++) {
		ql[i] = ql[i - 1] + tme(i) + m;
		if (ql[i] + tme(0) <= t)
			ans = max(ans, i + 1);
	}

	qr[0] = 0;
	for (int i = 1; i < n; i++) {
		qr[i] = qr[i - 1] + tme(n - i) + m;
		if (qr[i] + tme(0) <= t)
			ans = max(ans, i + 1);
	}

	for (int i = 0; i < n; i++) {
		int v = ql[i] + tme(0) + i * m;
		if (v > t)
			continue;
		int lefttime = t - v;

		int l = 0, r = n - 1, qm;
		while (l + 1 < r) {
			qm = l + (r - l) / 2;
			if (f(lefttime, qm) == 1) {
				l = qm;
			} else {
				r = qm;
			}
		}
		if (f(lefttime, r) == 1)
			ans = max(ans, i + r + 1);
		else
			ans = max(ans, i + l + 1);
	}

	for (int i = 0; i < n; i++) {
		int v = qr[i] + tme(0) + i * m;
		if (v > t)
			continue;
		int lefttime = t - v;

		int l = 0, r = n - 1, qm;
		while (l + 1 < r) {
			qm = l + (r - l) / 2;
			if (f2(lefttime, qm) == 1) {
				l = qm;
			} else {
				r = qm;
			}
		}
		if (f2(lefttime, r) == 1)
			ans = max(ans, i + r + 1);
		else
			ans = max(ans, i + l + 1);
	}

	cout << min(ans, (int)n);
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <map>
#include <algorithm>

#define lli long long int
#define ui unsigned long long int

using namespace std;

lli n, k, m, h1, h2, x, y, t;
string s;

int tme(int ind) {
	int v = 0;
	if (s[ind] == 'w')
		v += k;
	v++;
	return v;
}

int f (int cnt) {
	int l = n - 1, r = 1, tt = 0, indx = 0;
	tt += tme(0);
	if (tt > t) {
		return 0;
	}
	int cnq = 0;
	while (tt <= t) {
		if (tme(l) + abs(l - indx) * m < tme(r) + abs(r - indx) * m) {
			tt += tme(l) + abs(l - indx) * m;
			indx = l;
			l--;
			l = (l + n) % n;
		} else {
			tt += tme(r) + abs(r - indx) * m;
			indx = r;
			r++;
			r %= n;
		}
		cnq++;
	}
	return cnq >= cnt;
}

int main() {

	cin >> n >> m >> k >> t >> s;

	int l = 0, r = n, qm;
	while (l + 1 < r) {
		qm = l + (r - l) / 2;
		if (f(qm) == 1) {
			l = qm;
		} else {
			r = qm;
		}
	}

	if (f(r) == 1)
		cout << r;
	else
		cout << l;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <string.h>
#include <map>
#include <algorithm>

#define lli long long int
#define ui unsigned long long int

using namespace std;

lli n, k, m, h1, h2, x, y, t;
string s;

int tme(int ind) {
	int v = 0;
	if (s[ind] == 'w')
		v += k;
	v += m;
	return v;
}

int f (int cnt) {
	int l = n - 1, r = 1, tt = 0, indx = 0;
	tt += tme(0);
	if (tt > t) {
		return 0;
	}
	int cnq = 0;
	while (tt <= t) {
		if (tme(l) + abs(l - indx) < tme(r) + abs(r - indx)) {
			indx = l;
			tt += tme(l) + abs(l - indx);
			l--;
			l = (l + n) % n;
		} else {
			indx = r;
			tt += tme(r) + abs(r - indx);
			r++;
			r %= n;
		}
		cnq++;
	}
	return cnq >= cnt;
}

int main() {

	cin >> n >> m >> k >> t >> s;

	int l = 0, r = n, qm;
	while (l + 1 < r) {
		qm = l + (r - l) / 2;
		if (f(qm) == 1) {
			l = qm;
		} else {
			r = qm;
		}
	}

	if (f(r) == 1)
		cout << r;
	else
		cout << l;
}


#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
typedef long long ll;
using namespace std;

int  main ()
{
	int a1,b1,n,T;
	cin>>n>>a1>>b1>>T;
	int *f = new int [n+1];
	char *a = new char [n+1];
	int *back = new int [n+1];
	for (int i = 0;i<n;i++) cin>>a[i];
	//f[0] = ((a[0]=='w')?(b1+a1):a1);
	f[0] = 1 + ((a[0]=='w')?b1:0);
	back[0] = 0;
	for (int i = 1;i<n;i++)
	{
		f[i] = f[i - 1] + ((a[i]=='w')?(b1+a1+1):a1+1);
	}
	for (int i = 1;i<=n;i++)
	{
		back[i] = back[i - 1] + ((a[n - i]=='w')?(b1+a1+1):(a1+1));
	}
	int ans = INT_MIN;
	for (int i = 0;i < n;i++)
	{
		int l = 1;
		int r = n - i - 1;
		ll g;
		//if (i - 1 >= 0)
		if (i - 1 >= 0)
		g = f[i] + a1 * (i - 1);
		else
		g = f[i];
		//cout<<f[i]<<endl;
		if (g >= T) {if (f[i]<=T && i+1>ans) {ans = i+1;}continue;}
		//if (g == T) {if (ans > i) ans = i; continue;}
		int m = 0;
		//if (back[1] + g > T) {continue;}
		//if (back[1] + g == T) {if (i+1>ans) ans = i+1;continue;}
		if (l > r) {if (ans > i + 1 && f[i] <= T) ans = i + 1;continue;}
		bool k = false;
		//cout<<l<<" "<<r<<endl;
		while (l < r)
		{
			m = (l + r)/2;
			//cout<<m<<" "<<f[i]<<" "<<g<<" "<<back[m] + g<<endl;
			if (back[m] + g < T)
			{
				l = m + 1;
			}
			else if (back[m] + g > T)
			{
				r = m - 1;
			}
			else {k =true;break;}
			//cout<<i<<" "<<l<<" "<<r<<" "<<back[l]<<endl;
		}
		//cout<<l<<" "<<r<<endl;
		//cout<<i<<" "<<l<<endl;
		if (!k && ((i + l + 1) > ans) && (g+back[l]<=T)) {ans = i + l + 1;continue;}
		if (!k && ((i + l) > ans)) ans = i + l;
		if (k && (i + m + 1) > ans)
		{
			ans = i + m + 1;
		}
		//cout<<ans<<endl;
	}
	if (ans!=INT_MIN)
	cout<<ans;
	else
	cout<<0;
	//system("pause");
	return 0;
}


#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
typedef long long ll;
using namespace std;

int  main ()
{
	ll  a1,b1,n,T;
	cin>>n>>a1>>b1>>T;
	ll  *f = new ll  [n+1];
	char *a = new char [n+1];
	ll  *back = new ll  [n+1];
	for (ll  i = 0;i<n;i++) cin>>a[i];
	//f[0] = ((a[0]=='w')?(b1+a1):a1);
	f[0] = 1 + ((a[0]=='w')?b1:0);
	back[0] = 0;
	for (ll  i = 1;i<n;i++)
	{
		f[i] = f[i - 1] + ((a[i]=='w')?(b1+a1+1):a1+1);
	}
	for (ll  i = 1;i<=n;i++)
	{
		back[i] = back[i - 1] + ((a[n - i]=='w')?(b1+a1+1):(a1+1));
	}
	ll  ans = LLONG_MIN;
	for (ll  i = 0;i < n;i++)
	{
		ll  l = 1;
		ll  r = n - i - 1;
		ll g;
		//if (i - 1 >= 0)
		if (i > 0)
		g = f[i] + a1 * i;
		else
		g = f[i];
		//cout<<f[i]<<endl;
		if (g >= T) {if (f[i]<=T && i+1>ans) {ans = i+1;}continue;}
		//if (g == T) {if (ans > i) ans = i; continue;}
		ll  m = 0;
		//if (back[1] + g > T) {continue;}
		//if (back[1] + g == T) {if (i+1>ans) ans = i+1;continue;}
		if (l > r) {if (i+1 > ans && f[i] <= T) ans = i + 1;continue;}
		bool k = false;
		//cout<<l<<" "<<r<<endl;
		while (l < r)
		{
			m = (l + r)/2;
			//cout<<m<<" "<<f[i]<<" "<<g<<" "<<back[m] + g<<endl;
			if (back[m] + g < T)
			{
				l = m + 1;
			}
			else if (back[m] + g > T)
			{
				r = m - 1;
			}
			else {k =true;break;}
			//cout<<i<<" "<<l<<" "<<r<<" "<<back[l]<<endl;
		}
		//cout<<i<<" "<<l<<" "<<r<<endl;
		//cout<<i<<" "<<l<<endl;
		if (!k && ((i + l + 1) > ans) && (g+back[l]<=T)) {ans = i + l + 1;continue;}
		if (!k && ((i + l) > ans) && (g+back[l - 1]<=T)) ans = i + l;
		if (k && (i + m + 1) > ans)
		{
			ans = i + m + 1;
		}
		//cout<<ans<<endl;
	}
	for (ll  i = 1;i < n;i++)
	{
		f[i]-=f[0];
	}
	for (ll  i = 1;i < n;i++)
	{
		ll  l = 0;
		ll  r = n - i - 1;
		ll g;
		//if (i - 1 >= 0)
		//if (i > 0)
		g = back[i] + a1 * i + f[0];
		//else
		//g = f[i];
		//cout<<f[i]<<endl;
		if (g >= T) {if ((back[i] + f[0]) <= T && i + 1 > ans) {ans = i + 1;}continue;}
		//if (g == T) {if (ans > i) ans = i; continue;}
		ll  m = 0;
		//if (back[1] + g > T) {continue;}
		//if (back[1] + g == T) {if (i+1>ans) ans = i+1;continue;}
		if (l >= r) {if (i+1 > ans && (back[i] + f[0]) <= T) ans = i + 1;continue;}
		bool k = false;
		//cout<<l<<" "<<r<<endl;
		while (l < r)
		{
			m = (l + r)/2;
			//cout<<m<<" "<<f[i]<<" "<<g<<" "<<back[m] + g<<endl;
			if (f[m] + g < T)
			{
				l = m + 1;
			}
			else if (f[m] + g > T)
			{
				r = m - 1;
			}
			else {k =true;break;}
			//cout<<i<<" "<<l<<" "<<r<<" "<<back[l]<<endl;
		}
		//cout<<i<<" "<<l<<" "<<r<<endl;
		//cout<<i<<" "<<l<<endl;
		if (!k && ((i + l + 1) > ans) && (g + f[l]<=T)) {ans = i + l + 1;continue;}
		if (!k && ((i + l) > ans) && (g + f[l - 1]<=T)) ans = i + l;
		if (k && (i + m + 1) > ans)
		{
			ans = i + m + 1;
		}
		//cout<<ans<<endl;
	}
	if (ans!=LLONG_MIN)
	cout<<ans<<endl;
	else
	cout<<0;
	//system("pause");
	return 0;
}


#include<iostream>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
typedef long long ll;
using namespace std;

int  main ()
{
	int a1,b1,n,T;
	cin>>n>>a1>>b1>>T;
	int *f = new int [n+1];
	char *a = new char [n+1];
	int *back = new int [n+1];
	for (int i = 0;i<n;i++) cin>>a[i];
	//f[0] = ((a[0]=='w')?(b1+a1):a1);
	f[0] = 1 + ((a[0]=='w')?b1:0);
	back[0] = 0;
	for (int i = 1;i<n;i++)
	{
		f[i] = f[i - 1] + ((a[i]=='w')?(b1+a1+1):a1+1);
	}
	for (int i = 1;i<=n;i++)
	{
		back[i] = back[i - 1] + ((a[n - i]=='w')?(b1+a1+1):(a1+1));
	}
	int ans = INT_MIN;
	for (int i = 0;i < n;i++)
	{
		int l = 1;
		int r = n - i - 1;
		ll g;
		//if (i - 1 >= 0)
		if (i - 1 >= 0)
		g = f[i] + a1 * (i - 1);
		else
		g = f[i];
		//cout<<f[i]<<endl;
		if (g >= T) {if (f[i]<=T && i+1>ans) {ans = i+1;}continue;}
		//if (g == T) {if (ans > i) ans = i; continue;}
		int m = 0;
		//if (back[1] + g > T) {continue;}
		//if (back[1] + g == T) {if (i+1>ans) ans = i+1;continue;}
		if (l > r) {if (ans > i + 1 && f[i] <= T) ans = i + 1;continue;}
		bool k = false;
		//cout<<l<<" "<<r<<endl;
		while (l < r)
		{
			m = (l + r)/2;
			//cout<<m<<" "<<f[i]<<" "<<g<<" "<<back[m] + g<<endl;
			if (back[m] + g < T)
			{
				l = m + 1;
			}
			else if (back[m] + g > T)
			{
				r = m - 1;
			}
			else {k =true;break;}
			//cout<<i<<" "<<l<<" "<<r<<" "<<back[l]<<endl;
		}
		//cout<<l<<" "<<r<<endl;
		//cout<<i<<" "<<l<<endl;
		if (!k && ((i + l + 1) > ans) && (g+back[l]<=T)) {ans = i + l + 1;continue;}
		if (!k && ((i + l) > ans) && (g+back[l - 1]<=T)) ans = i + l;
		if (k && (i + m + 1) > ans)
		{
			ans = i + m + 1;
		}
		//cout<<ans<<endl;
	}
	if (ans!=INT_MIN)
	cout<<ans;
	else
	cout<<0;
	//system("pause");
	return 0;
}