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;
 
#define int long long
#define double long double
#define pii pair<int,int>
#define vi vector<int>
#define uii unordered_map<int,int>
#define pqmax priority_queue<int>
#define pqmin priority_queue<int, vector<int>, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zerobits(x) __builtin_ctzll(x)
#define fo(i,n) for(int i = 0; i < n; i++)
#define nl "\n"
#define mp make_pair
#define pb push_back
#define mk(a,n,type) type *a = new type[n]
#define fi first
#define se second
#define INF 2e18
#define mod 1000000007
#define pi 3.14159265358979323846
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
int gcd(int a, int b){if(!b)return a;return gcd(b, a % b);} 
int power(int x,int y,int p =mod ){int res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int lcm(int a , int b){return (a*b)/gcd(a,b);}



int solve(vector<string> &s, int n, int m, int i, int j){
    if(i==n || j==m){
        return 0;
    }



    int cur = 0;
    if(s[i][j] == '*'){
        cur++;
    }
    
    int op1 = cur + solve(s, n, m, i+1, j);
    int op2 = cur +  solve(s, n, m, i, j+1);

    return max(op1, op2);
}

int32_t main(){
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());

int t = 1;
// cin >> t;

    while (t--) {
        int n,m;
        cin>>n>>m;
        vector<string> s;
        for(int i=0; i<n; i++){
            string x;
            cin>>x;
            s.pb(x);
        }

        int xs =0, ys =0, ans=0;
        if(s[0][0] == '*'){
            ans++;
        }
        while(1){
            vector<pair<int, pair<int,int> >> tem;
            for(int i= xs; i<n; i++){
                for(int j=ys; j<n; j++){
                    if(i==xs && j==ys) continue;
                    if(s[i][j]=='*'){
                        int x = i - xs;
                        int y = j - ys;
                        int d = x+y;
                        tem.pb(mp(d, mp(i,j)));
                    }
                }
            }

            if(tem.empty()){
                break;
            }
            ans++;
            sort(all(tem));
            xs =  tem[0].second.first;
            ys =  tem[0].second.second;
        }
        cout<<ans<<"\n";
    }

 return 0;
}