while True:
    try:
        n,m = map(int,input().split())
        dics = {'l':4,'o':3,'v':2,'e':1}
        dp = [[0 for _ in range(m+1)] for i in range(n+1)]
        chars = []
        for i in range(n):
            chars.append(input())
        for i in range(1,n+1):
            for j in range(1,m+1):
                if chars[i-1][j-1] in dics.keys():
                    dp[i][j] = max(dp[i-1][j]+dics[chars[i-1][j-1]],dp[i][j-1]+dics[chars[i-1][j-1]])
                else:
                    dp[i][j] = max(dp[i-1][j],dp[i][j-1])
        print(dp[n][m])
    except:
        break