
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#include <cstring>
#include <cstdio>
#include <stack>
#define INF 1000000000
#define rep(i,n) for(int i =0;i<n;i++)
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b){
    if (a==0 or b == 0) {
        return 1;
    }
    ll aa = max(a,b);
    ll bb = min(a,b);
    while (aa % bb != 0) {
        ll tmp = bb;
        bb = aa%bb;
        aa = tmp;
    }
    return bb;
}


pair<ll, ll> g(ll aa,ll ab, ll ba, ll bb){
    ll c = ab * bb;
    ll d = aa*bb - ba*ab;
    ll cd = gcd(d,c);
    return {d/cd,c/cd};
}

pair<ll, ll> h(ll aa,ll ab, ll ba, ll bb){
    ll c = ab * bb;
    ll d = aa*bb + ba*ab;
    ll cd = gcd(d,c);
    return {d/cd,c/cd};
}

ll fac2(int n){
    if (n==0) {
        return 1;
    }else{
        return 2*fac2(n-1);
    }
}

int main(){
    for (;;){
        string s;
        cin >> s;
        if(s=="#")break;
        vector<int> dir;
        for (int i=0; i<s.length(); i++) {
            if(s[i]=='n'){
                dir.push_back(1);
                i+=4;
            }else{
                dir.push_back(2);
                i+=3;
            }
        }
        pair<ll, ll> ans = {0,0};
        if (dir[dir.size()-1]==1) {
            ans = {0,1};
        }else{
            ans = {90,1};
        }
        for (int i=(int)dir.size()-2; i>=0; i--) {
            if (dir[i]==1) {
                ans = g(ans.first,ans.second,90,fac2((int)dir.size()-1-i));
            }else{
                ans = h(ans.first,ans.second,90,fac2((int)dir.size()-1-i));
            }
        }
        if (ans.second==1) {
            cout <<ans.first<<endl;
        }else{
            cout <<ans.first<<"/"<<ans.second<<endl;
        }
    }
}