#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	ifstream in("poker.in");
	ofstream out("poker.out");
	int x, b;
	char c;

	in >> x >> b >> c;
	int round = x / (3 * b);
	int tmp = (c == 'L' ? 1 : 2);
	if (round * (3 * b) == x) 
		out << 2 * round;
	else if (round * (3 * b) + tmp * b >= x)
		out << 2 * round + 1;
	else 
		out << 2 * round + 2;
	return 0;
}