#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string S;
int main() {
  while (cin >> S) {
	if (S == "#") break;
	long long deg = 0;
	int n = 0, w = 0;
	reverse(S.begin(), S.end());
	for (int i = 0; i < S.size();) {
	  if (S.substr(i, 5) == "htron") {
		if (i != 0) deg *= 2, --deg;
		++n, i += 5;
	  }
	  else {
		deg *= 2, ++deg, ++w, i += 4;
	  }
	}
	deg *= 90;
	int num = n + w - 1;
	long long all = 1LL<<num;

	//cout << deg << ", " << all << endl;
	
	while (deg % 2 == 0 && all % 2 == 0) deg /= 2, all /= 2;
	
	if (all == 1) cout << deg << endl;
	else cout << deg << "/" << all << endl;
  }
}

