import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Ferry {
public static void main
(String[] args
) {
Scanner input
= new Scanner
(System.
in); int numberOfTestcases = input.nextInt();
double ferryLength = input.nextInt();
int numberOfCars = input.nextInt();
double carLength = input.nextInt();
String carStartSide
= input.
next();
List<Car> ferry = new ArrayList<Car>();
Car cr = new Car();
ferry.add(cr);
List<Car> boatArray = new ArrayList<Car>();
double lengthCarOnFerry = 0;
int count = 0;
while(true)
{
if((count % 2) == 0) // You are on the left side
{
for(int i = 0; i < ferry.size(); i++)
{
if(lengthCarOnFerry <= ferryLength && cr.getSide() == "left") // If any car are on the left side
{
if(ferry.size() > numberOfCars)
{
}
else
{
boatArray.add(ferry.get(i)); // Add it to the boatarray
break;
}
}
}
}
else // You are on the right side
{
for(int i = 0; i < ferry.size(); i++)
{
if(lengthCarOnFerry <= ferryLength && cr.getSide() == "right") // If any car are on the right side
{
boatArray.add(ferry.get(i)); // Add it to the boatarray
}
}
break;
}
count++;
}
}
}