#include<cstdio>
#include<queue>
#include<utility>
#define sheep first
#define wolf second
using namespace std;
typedef pair<int, int> pii;
const int M = 333;
const int dr[] = { 0, 1, 0,-1 };
const int dc[] = { 1, 0,-1, 0 };
char imap[M][M];
bool vis[M][M];
pii ans;
int ROW, COL;
struct pos {
int R, C;
pos(int ir, int ic) : R(ir), C(ic) {}
};
pii bfs(int ro, int co) {
pii ret;
ret.sheep = ret.wolf = 0;
queue<pos> Q; Q.push(pos(ro,co));
vis[ro][co] = true;
if (imap[ro][co] == 'o') ret.sheep++;
if (imap[ro][co] == 'v') ret.wolf++;
while (!Q.empty()) {
int hr = Q.front().R;
int hc = Q.front().C;
Q.pop();
for (int i = 0; i < 4; i++) {
int tr = hr + dr[i];
int tc = hc + dc[i];
if (tr < 0 || ROW <= tr || tc < 0 || COL <= tc) continue;
if (!vis[tr][tc] &&
(imap[tr][tc] != '#')) {
vis[tr][tc] = true;
Q.push(pos(tr, tc));
if (imap[tr][tc] == 'o') ret.sheep++;
if (imap[tr][tc] == 'v') ret.wolf++;
}
}
}
return ret;
}
int main() {
scanf("%d%d", &ROW, &COL);
for (int r = 0; r < ROW; r++) {
scanf("%s", imap[r]);
}
for (int r = 0; r < ROW; r++) {
for (int c = 0; c < COL; c++) {
pii ret;
if (!vis[r][c] &&
(imap[r][c] != '#')) {
ret = bfs(r, c);
if (ret.sheep > ret.wolf) ret.wolf = 0;
else ret.sheep = 0;
}
ans.sheep += ret.sheep;
ans.wolf += ret.wolf;
}
}
printf("%d %d", ans.sheep, ans.wolf);
return 0;
}