#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);

struct Input
{
	int n;char c;char str[1024];string s;ll l;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;

ll pow2(ll x, int n){
	if(n == 0) return 1LL;
	ll ret = pow2(x * x, n / 2);
	if(n & 1) ret *= x;
	return ret;
}

ll gcd(ll a, ll b){
	return b == 0LL ? a : gcd(b, a % b);
}

int main(){
	while(1){
		string s;// = in.next();
		cin>>s;
		if(s == "#") break;
		
		vi v;
		int idx = 0;
		while(idx < s.size()){
			if(s[idx] == 'n'){
				v.pb(1);
				idx += 5;
			}
			else{
				v.pb(0);
				idx += 4;
			}
		}
		//reverse(all(v));
		
		ll a = pow2(2LL, v.size()-1) * (v.back()==1?0LL:90LL);
		ll b = pow2(2LL, v.size()-1);
			
		rep(i, v.size()-1){
			a += (v[i] == 1 ? -1 : 1) * 90 * pow2(2LL, i);
		}
		// cout<<v.size()<<" "<<pow2(2LL, v.size())<<endl;
		// cout<<a<<" / "<<b<<endl;
		
		ll k = gcd(a, b);
		a /= k;
		b /= k;
		
		printf("%lld", a);
		if(b != 1LL){
			printf("/%lld", b);
		}
		printf("\n");
	}
}