Problem: A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.

The mouse is in a bit of a hurry, though, so once she enters the cake from its northwest corner (the top left cell in the input data), she will only go east (right) or south (down), until she reaches the southeast corner (the bottom right cell). She will eat every berry in the squares she passes through, but not in the other squares.

The mouse tries to choose her path so as to maximize the number of berries consumed. However, her haste and hunger might be clouding her judgement, leading her to suboptimal decisions...

Input

The first line of input contains two integers H and W (1 ≤ H, W ≤ 5), separated by a space, — the height and the width of the cake.

The next H lines contain a string of W characters each, representing the squares of the cake in that row: '.' represents an empty square, and '*' represents a square with a berry.

Output

Output the number of berries the mouse will eat following her strategy.

Examples

Input


4 3
*..
.*.
..*
...


Output


3


Input


4 4
.*..
*...
...*
..*.


Output


2


Input


3 4
..**
*...
....


Output


1


Input


5 5
..*..
.....
**...
**...
**...


Output


1

Solution (in CPP):

Solution:
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2")
#include<bits/stdc++.h>
//#include<chrono>
//#include<random>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;

#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define MaxN 100005
#define N (ll)998244353 // prime modulo value 
#define all(x) x.begin(),x.end()
#define watch(x) cout << (#x) << " is " << (x) << endl
using namespace std;
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 mt(seed);

int myrand(int mod) {
	return mt()%mod;
}

inline ll gcd(ll a, ll b)
{
	// This is code taken from geeksforgeek
	if (b == 0)
		return a;
	return gcd(b, a % b);
}

ll mod_power(ll x, ll y)
{
	// This is code taken from geeksforgeek
	ll res = 1;

	x = x % N;
	if (x == 0) return 0;
	while (y > 0)
	{
		if (y & 1)
			res = (res * x) % N;
		y = y >> 1;
		x = (x * x) % N;
	}
	return res;
}
long long modInverse(long long n)
{
	return mod_power(n, N - 2);
}

// Returns nCr % p using Fermat's little 
// theorem. 
long long nCrModPFermat(long long n,
	ll r)
{
	// This is code taken from geeksforgeek
	if (r == 0)
		return 1;
	vector<ll> fac(n + 1, 0);
	fac[0] = 1;
	for (int i = 1; i <= n; i++)
		fac[i] = (fac[i - 1] * i) % N;

	return (fac[n] * modInverse(fac[r]) % N * modInverse(fac[n - r]) % N) % N;
}


bool isprime(ll n)
{
	if (n == 2)
		return true;
	if (n % 2 == 0 || n == 1)
	{
		return false;
	}
	for (ll j = 3; j <= sqrt(n); j += 2)
	{
		if (n % j == 0)
		{
			return false;
		}
	}
	return true;
}



int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("inputD.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	// __int128
	ll h,w;
	cin>>h>>w;
	vector<string> arr(h,"");
	for(ll i=0;i<h;i+=1)cin>>arr[i];
	ll x=0,y=0;
	ll cnt=0;
	if(arr[0][0]=='*')cnt+=1;
	while(1)
	{
		ll mini=INF,a,b;
		for(ll i=x;i<h;i+=1)
		{
			for(ll j=y;j<w;j+=1)
			{
				if(i==x && j==y)continue;
				if(arr[i][j]=='*')
				{
					ll dist=abs(i-x)+abs(j-y);
					if(mini>dist){mini=dist;a=i;b=j;}
				}
			}
		}
		if(mini!=INF){cnt+=1;x=a;y=b;}
		else break;
	}cout<<cnt;

	return 0;
}