#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main()
{
	string s = "", arr[7] = {"SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI" };
	int daysCount = 0, i = 0;
	cin >> s;
	bool startCounting = false, passedIter1 = false;
	while(true)
	{
		if (arr[i] == "SUN" && passedIter1)
		{
			break;
		}
		else if(s == arr[i])
		{
			startCounting = true;
		}
		if (startCounting)
		{
			daysCount++;
			passedIter1 = true;
		}	
		i++;
		if (i == 7)
		{
			i = 0;
		}
		
	}
	cout << daysCount << endl;
	//system("pause");
	return 0;
}