#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int gcd(int a,int b)
{
    if(a % b == 0){
        return b;
    }
    return gcd(b,a%b);
}

int main()
{
    while(1){
        string s;
        cin >> s;
        if(s == "#"){
            break;
        }
        int i = 0;
        vector<int> vec;
        while(i < s.length()){
            if(s[i] == 'n'){
                vec.pb(-1);
                i += 5;
            }else{
                vec.pb(1);
                i += 4;
            }
        }
        int a1 = 0;
        int a2 = pow(2,vec.size()-1);
        for(int i = vec.size()-1;i>=0;i--){
            if(vec[i] > 0 || a1 > 0){
                a1 += pow(2,i)*vec[i];
            }
        }
        if(a1 == 0){
            cout << "0\n";
        }else{
            a1 *= 90;
            int hoge = gcd(a1,a2);
            a1 /= hoge;
            a2 /= hoge;
            if(a2 ==1){
                cout << a1 << "\n";
            }else{
                cout << a1 << "/" << a2 << "\n";
            }
        }
    }
}