#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

vector<string>sts(10);

long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}

int main() {
	while (1) {
		string st; cin >> st;
		if (st == "#")break;
		vector<bool>ns;
		for (int i = 0; i < st.size(); ++i) {
			if (st[i] == 'n') {
				i += 4;
				ns.push_back(false);
			}
			else {
				i += 3;
				ns.push_back(true);
			}
		}
		
		if (ns.size() >= 3) {
			long long int ans = powint(2, ns.size() - 2);
			for (int i = 0; i <ns.size() - 2; ++i) {
				if (ns[i]) {
					ans += powint(2, i);
				}
				else {
					ans -= powint(2, i);
				}
			}
			long long int num = 45 * ans;
			cout << num << "/" << powint(2, ns.size() - 2) << endl;
		}
		else {
			if (st == "north")cout << 0 << endl;
			else if (st == "west")cout << 90 << endl;
			else cout << 45 << endl;
		}
	}
	return 0;
}