#include <fstream>
#include <cstdio>

using namespace std;

int main()
{
	ifstream cin("poker.in");
	ofstream cout("poker.out");
	long long x, a;
	cin >> x >> a;
	char c;
	cin >> c;
	long long cnt;
	if (c == 'L')
	{
		cnt = x / (3 * a);
		if (cnt * (3 * a) == x) cnt = 2 * cnt;
		else
			if (cnt * (3 * a) + a >= x) cnt = 2 * cnt + 1;
			else cnt = 2 * cnt + 2;
	}
	else
	{
		cnt = x / (3 * a);
		if (cnt * (3 * a) == x) cnt = 2 * cnt;
		else
			if (cnt * (3 * a) + 2 * a >= x) cnt = 2 * cnt + 1;
			else cnt = 2 * cnt + 2;
	}
	cout << cnt;
}