//这题有几个需要特别注意的地方
//不能算对应的格子的数量/总数,只能通过计算每层的概率得到
//一开始用计算总数,计得5/14和sample里的7/16对不上
//这里的层数有50层, 2^50次方,用unsigned long long
//在计算lcm时,要先除再乘,不然会溢出。
//在计算gcd时,传入的参数a,b要满足a>b
//因为这些原因各种错误RE,WA
#include<iostream>
using namespace std;
const int N = 60;
unsigned long long gcd(unsigned long long a, unsigned long long b)
{
if (b == 0)
return a;
return gcd(b, a%b);
}
unsigned long long lcm(unsigned long long a, unsigned long long b)
{
if (a > b)
return a/gcd(a, b)*b;
else
return b/gcd(b, a)*a;
}
struct fraction
{
unsigned long long numerator;
unsigned long long denominator;
fraction () {numerator = 0; denominator = 1;}
fraction (unsigned long long numerator, unsigned long long denominator)
{
this->numerator = numerator;
this->denominator = denominator;
}
friend fraction operator/ (const fraction& a, int n)
{
return fraction(a.numerator, a.denominator*n);
}
friend fraction operator+ (const fraction& a, const fraction& b)
{
fraction result;
unsigned long long multiple, tmp;
tmp = lcm(a.denominator, b.denominator);
result.numerator = tmp/a.denominator*a.numerator + tmp/b.denominator*b.numerator;
result.denominator = tmp;
multiple = gcd(result.denominator, result.numerator);
result.numerator /= multiple;
result.denominator /= multiple;
return result;
}
};
char maze[N][N];
fraction dp[N][N];
int n, m;
int main()
{
while (cin >> n >> m)
{
for (int i = 1; i <= n; i++)
for (int j = 1; j <= i; j++)
{
cin >> maze[i][j];
dp[i][j].denominator = 1;
dp[i][j].numerator = 0;
}
for (int i = 1; i < N; i++)
{
maze[n+1][i] = '*';
dp[n+1][i].denominator = 1;
dp[n+1][i].numerator = 0;
}
for (int i = 1; i <= n+1; i++)
for (int j = 1; j <= i; j++)
{
if (maze[i][j] == '*')
{
if (i == 1 && j == 1)
{
dp[i][j].numerator = 1;
dp[i][j].denominator = 1;
}
else if (i > 1 && j > 1 && j < i)
dp[i][j] = dp[i-1][j-1]/2+dp[i-1][j]/2 + dp[i][j];
else if (i > 1 && j == 1)
dp[i][j] = dp[i-1][j]/2 + dp[i][j];
else if (i > 1 && j == i)
dp[i][j] = dp[i-1][j-1]/2 + dp[i][j];
}
else
{
dp[i][j].numerator = 0;
dp[i][j].denominator = 1;
int row = i+2;
int count = 1;
while (row <= n+1)
{
if (maze[row][j+count] == '*')
{
if (i == 1 && j == 1)
{
dp[row][j+count].numerator = 1;
dp[row][j+count].denominator = 1;
}
else if (j > 1 && j < i)
dp[row][j+count] = dp[i-1][j-1]/2 + dp[i-1][j]/2 + dp[row][j+count];
else if (i > 1 && j == 1)
dp[row][j+count] = dp[i-1][j]/2 + dp[row][j+count];
else if (i > 1 && j == i)
dp[row][j+count] = dp[i-1][j-1]/2 + dp[row][j+count];
break;
}
else
{
row += 2;
count++;
}
}
}
}
cout << dp[n+1][m+1].numerator << "/" << dp[n+1][m+1].denominator << endl;
}
return 0;
}