1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
#define dbg(x) " [" << #x << ": " << (x) << "] "
using namespace std;
template<typename A, typename B>
ostream& operator<<(ostream& out, const pair<A,B>& p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& c) {
    out << "{";
    for(auto it = c.begin(); it != c.end(); it++) {
        if(it != c.begin()) out << ", ";
        out << *it;
    }
    return out << "}";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    vector<string> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    if(n == 1) {
        string s = '.' + v[0] + '.';
        int cnt_comp = 0;
        for(int i = 1; i <= m; i++) {
            if(s[i] == '.' || s[i + 1] == 'O') continue;
            int x = s[i] == '?';
            x += s[i + 1] == '?';
            cnt_comp += 1 << (2 - x);
        }
        int cnt2 = 0;
        for(int i = 2; i <= m; i++) {
            if(s[i - 1] == '.' || s[i] == '.' || s[i + 1] == 'O' || s[i - 2] == 'O') continue;
            int x = s[i] == '?';
            x += s[i - 1] == '?';
            x += s[i - 2] == '?';
            x += s[i + 1] == '?';
            cnt2 += 1 << (4 - x);
        }
        int a = 4 * cnt_comp - cnt2;
        int g = gcd(a, 16);
        cout << a / g << "/" << 16 / g << endl;
    } else {
        cout << "5/2" << endl;
    }
    return 0;
}