import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;

void main()
{
	while (1) {
		auto str = readln.chomp;
		if (str == "#") break;
		int i = str.length-1;
		long a, b = 1;
		
		while (i > 0) {
			a *= 2;
			b *= 2;
			if (str[i] == 'h') {
				a -= 90;
				a = max(0, a);
				i -= 5;
			} else {
				a += 90;
				a = min(90*b/2, a);
				i -= 4;
			}
		}
		
		if (b != 2) {
			b /= 4;
			a /= 2;
		} else {
			b /= 2;
		}
		if (b == 1) a.writeln;
		else writeln(a, "/", b);
	}
}