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 PYTHON3):

Solution:
def try1(n, m):
    down = n
    right = m
    i = 0
    j = 0
    ans = 0
    iter = 0
    while i < n and j < m:
        # print(i, j)
        if matrix[i][j]=='*':
            ans += 1
        if i==n-1:
            if j==m-1:
                break
            else:
                j+=1
        else:
            if iter%2==0 or j==m-1:
                i+=1
            else:
                j+=1
        iter+=1
    return ans

def try2(n, m):
    down = n
    right = m
    i = 0
    j = 0
    ans = 0
    iter = 0
    while i < n and j < m:
        # print(i, j)
        if matrix[i][j]=='*':
            ans += 1
        if i==n-1:
            if j==m-1:
                break
            else:
                j+=1
        else:
            if iter%2==1 or j==m-1:
                i+=1
            else:
                j+=1
        iter+=1
    return ans

def try3(n, m):
    down = n
    right = m
    i = 0
    j = 0
    ans = 0
    iter = 0
    while i < n and j < m:
        # print(i, j)
        if matrix[i][j]=='*':
            ans += 1

        if i==n-1 and j==m-1:
            break
        r = i+1
        sr = 0
        fr = False
        while r < n:
            sr+=1
            if matrix[r][j]=='*':
                fr = True
                break
            r+=1

        c = j+1
        sc = 0
        fc = False
        while c < m:
            sc+=1
            if matrix[i][c]=='*':
                fc = True
                break
            c+=1

        if fc and fr:
            if sc<=sr:
                j = c
            else:
                i = r
        elif fc:
            j = c
        elif fr:
            i = r
        else:
            # if i<n-1:
            #     i+=1
            # else:
            #     j+=1
            if j<m-1:
                j+=1
            else:
                i+=1



        # if i==n-1:
        #     if j==m-1:
        #         break
        #     else:
        #         j+=1
        # else:
        #     if iter%2==1 or j==m-1:
        #         i+=1
        #     else:
        #         j+=1
        # iter+=1
    return ans

def try4(n, m):
    li = []
    for i in range(n):
        for j in range(m):
            if matrix[i][j]=='*':
                li.append((i, j))

    nearest_best = -1
    r = 0
    c = 0
    ans = 0
    while True:
        nearest_best = -1
        dist_best = 100
        for i in range(len(li)):
            x, y = li[i]
            if x>=r and y>=c:
                curr_dist = (x-r) + (y-c)
                if curr_dist<dist_best:
                    dist_best = curr_dist
                    nearest_best = i
                elif curr_dist==dist_best:
                    if x<li[nearest_best][0]:
                        nearest_best = i
        if nearest_best==-1:
            break
        ans+=1
        r = li[nearest_best][0]
        c = li[nearest_best][1]
        li.pop(nearest_best)

    return ans

n, m = map(int, input().split())

matrix = []
for i in range(n):
    row = input()
    matrix.append(row)





# while i < n:
#     if matrix[i][j]=='*':
#         ans += 1
#     i+=1
#
# while j < m:
#     if matrix[i][j]=='*':
#         ans += 1
#     j+=1
#
# if matrix[i][j]=='*':
#     ans += 1
# if n>m:
#     ans = try2(n, m)
# else:
#     ans = try1(n, m)

# ans = max(try1(n, m), try2(n, m))
# ans = try3(n, m)
ans = try4(n, m)
print(ans)


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

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