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:
import copy
import math

fin = None
fout = None
uabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
         'W', 'X', 'Y', 'Z']
abet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
        'w', 'x', 'y', 'z']


def start(filename):
    filename = filename.replace('.py', '')
    global fin
    global fout
    infile = filename + ".in"
    outfile = filename + ".out"
    fin = open(infile)
    fout = open(outfile, "w")


def permutation(lst):
    if len(lst) == 0:
        return []
    if len(lst) == 1:
        return [lst]
    l = []
    for i in range(len(lst)):
        m = lst[i]
        remLst = lst[:i] + lst[i + 1:]
        for p in permutation(remLst):
            l.append([m] + p)
    return l


def subsets(x):
    retset = []
    if len(x) == 0:
        retset = [[]]
    else:
        first = x[-1]
        cop = x.copy()
        cop.remove(first)
        y = subsets(cop)
        retset.extend(copy.deepcopy(y))
        m = copy.deepcopy(y)
        for i in range(len(y)):
            k = m[0]
            m.remove(k)
            k.append(first)
            m.append(k)
        retset.extend(m.copy())
    return retset


class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __str__(self):
        return str(self.x) + str(self.y)

    def __hash__(self):
        return hash(str(self))

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y


class frac:
    def __init__(self, n, d):
        self.n = n
        self.d = d

    def __str__(self):
        return str(self.n) + '/' + str(self.d)

    def __hash__(self):
        return hash(str(self))

    def simp(self):
        div = math.gcd(self.n, self.d)
        self.n = self.n / div
        self.d = self.d / div

    def __eq__(self, other):
        return self.n / self.d == other.n / other.d

    def __lt__(self, other):
        return self.n / self.d < other.n / other.d


class Interval:
    def __init__(self, start, end):
        self.start = start
        self.end = end

    def __str__(self):
        return str(self.start) + str(self.end)

    def __hash__(self):
        return hash(str(self))

    def __eq__(self, other):
        return self.start == other.start and self.end == other.end

    def __lt__(self, other):
        return self.start < other.start


def overlap(verl1, verl2):
    if verl1.end >= verl2.start:
        return True
    else:
        return False


def merge(verl1, verl2):
    retverl = Interval(min(verl1.start, verl2.start), max(verl1.end, verl2.end))
    return retverl


def changeBase(num, base):
    if base == 2:
        return "{0:b}".format(num)
    power = math.floor(math.log(num, base))
    remainder = num
    end = []
    iter = list(range(power + 1))
    iter.reverse()
    for i in iter:
        if remainder >= base ** i:
            q, r = divmod(remainder, base ** i)
            end.append(q)
            remainder = r
        else:
            end.append(0)
    retlist = []
    for i in end:
        if i > 9:
            retlist.append(uabet[i - 10])
        else:
            retlist.append(i)
    retlist = map(str, retlist)
    return ''.join(retlist)


def prime(num):
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    for i in range(2, math.ceil(num ** 0.5) + 1):
        if num % i == 0:
            return False
    return True


def fn(g,t):
   # print(g)
    if g == [['.']]:
        print(t)
        exit()
    f = {}
    for i in range(len(g)):
        for j in range(len(g[i])):
            if g[i][j] == '*':
                if i+j in list(f.keys()):
                    if j>f[i+j][1]:
                        f[i+j] = [i,j]
                else:
                    f[i+j] = [i,j]
    #print(f)
    x = list(f.keys())
    if x==[]:
        print(t)
        exit()
    x.sort()
    m = x[0]
    c = 0
    #print(f)
    for i in range(len(x)):
        if x[i]==m:
            if f[x[i]][1]>f[x[c]][1]:
                c = i
    v = f[x[0]]
    t+=1
    for i in range(v[0]):
        del g[0]
    for  i in g:
        for j in range(v[1]):
            del i[0]
    g[0][0] = '.'
    fn(g,t)

def main():
    h,w = map(int,input().split(' '))
    g=  []
    for i in range(h):
        g.append(list(input()))
    fn(g,0)

# code timer

main()