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:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e18+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
void YESNO(ll a){cout<<(a ? "YES" : "NO")<<endl;}
ll n,m;
char arr[5][5];
int main(void){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,m;
    cin>>n>>m;
    set<ii>exo;
    ll dp[5][5];
    memset(dp,0,sizeof dp);
    f(i,0,n){
        f(j,0,m){
            cin>>arr[i][j];
            if(arr[i][j] == '*'){
                exo.insert(ii(i,j));
            }
        }
    }
    if(arr[0][0] == '*'){
        dp[0][0] = 1;
    }
    ll ans = dp[0][0];
    set<ii>ok;
    ok.insert(ii(0,0));
    f(i,0,n){
        f(j,0,m){
            ll mini = INF;
            if(exo.count(ii(i,j))){
                exo.erase(ii(i,j));
            }
            for(auto x:exo){
                if(x.F >= i && x.S >= j){
                    mini = min(1000 * (abs(i - x.F)+abs(j - x.S)) + abs(i-x.F),mini);
                }
            }
            for(auto x:exo){
                if(x.F >= i && x.S >= j){
                    if(mini == 1000 * (abs(i - x.F)+abs(j - x.S)) + abs(i-x.F)){
                        dp[x.F][x.S] = max(dp[x.F][x.S],(arr[x.F][x.S] == '*') + dp[i][j]);
                        if(ok.count(ii(i,j))){
                            ok.insert(ii(x.F,x.S));
                            ans = max(ans,dp[x.F][x.S]);
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<"\n";
}