/*
Time:2019.12.5
Author: Goven
type:模拟-数值
ref:
*/
#include<iostream>
using namespace std;
int main()
{
int M, T, U, F, D;
cin >> M >> T >> U >> F >> D;
char c;
int i, tp1 = U + D, tp2 = F * 2;
for (i = 0; i < T && M > 0; i++) {
cin >> c;
if (c == 'u' || c == 'd') M -= tp1;
else M -= tp2;
}
for (int j = i; j < T; j++) cin >> c;
if (M < 0) i--;
cout << i << endl;
return 0;
}
网友评论