import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;
import std.numeric;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

class Fraction {
public:
	long n, d;
	this(long n, long d) {
		auto g = gcd(abs(n), d);
		this.n = n/g;
		this.d = d/g;
	}
	Fraction opUnary(string s) () if(s == "-") {
		return new Fraction(-n, d);
	}
	Fraction opBinary(string op) (Fraction r) {
		static if (op == "+"){
			return new Fraction(n*r.d + r.n*d, d*r.d);
		} else static if(op == "-") {
			return this + (-r); 
		} else static assert(0);
	}
}
unittest {
	auto f1 = Fraction(2,3);
	auto f2 = Fraction(12, 5);
	auto f3 = f1+f2;
	assert(f3.n == 46 && f3.d == 15);
}

void main(){
	while(true) {
		auto l = readln().chomp.dup.reverse;
		if(l == "#") return;

		auto f = (){
			if(l[0] == 'h') {
				l = l[5..$];
				return new Fraction(0, 1);
			} else {
				l = l[4..$];
				return new Fraction(90, 1);
			}
		}();
		auto n = 1;
		while(!l.empty) {
			if(l[0] == 'h') {
				f = f - new Fraction(90, 2L^^n);
				l = l[5..$];
			} else {
				f = f + new Fraction(90, 2L^^n);
				l = l[4..$];
			}
			++n;
		}
		if(f.d > 1) {
			writeln(f.n, "/", f.d);
		} else {
			writeln(f.n);
		}
	}
}