import std.stdio : readln, writeln;
import std.array : split;
import std.conv : to;
import std.typecons;
import std.algorithm : map;
import std.range : iota;
import std.string : chomp;

char[Tuple!(int, int)] field;
int W, H;

void dfs(int x, int y, char f) {
  field[tuple(x, y)] = 'a';
  foreach (dx; [-1, 1]) {
    int nx = x + dx;
    if (0 <= nx && nx < W
        && field[tuple(nx, y)] == f) dfs(nx, y, f);
  }
  foreach (dy; [-1, 1]) {
    int ny = y + dy;
    if (0 <= ny && ny < H
        && field[tuple(x, ny)] == f) dfs(x, ny, f);
  }
}

void main() {&#160; 
  auto input = map!(to!int)(split(chomp(readln()))[0 .. 2]);
  W = input[0], H = input[1];
&#160;&#160;int res = 0;
&#160;&#160;writeln(res);
}