#include <iostream>
using namespace std;

int main() {
    int n = 0;
    int m = 0;
    cin >> n >> m;
    int arr[n][m];
    char a = '\0';  
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a;
            switch(a)
            {
                case 'l':
                    arr[i][j] = 4;
                    break;
                case 'o':
                    arr[i][j] = 3;
                    break;
                case 'v':
                    arr[i][j] = 2;
                    break;
                case 'e':
                    arr[i][j] = 1;
                    break;
                default:
                    arr[i][j] = 0;
                    break;
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (i == 0 && j > 0)    //第一行除第一个元素外
            {
                arr[i][j] += arr[i][j-1];
            }
            else if(j == 0 && i > 0)    //第一列除第一个元素外
            {
                arr[i][j] += arr[i-1][j];
            }
            else if(j > 0 && i > 0)
            {
                arr[i][j] += (arr[i][j-1] > arr[i-1][j] ? arr[i][j-1] : arr[i-1][j]);
            }
        }
    }

    cout << arr[n-1][m-1];
    return 0;
}
// 64 位输出请用 printf("%lld")