// Задача "Отель"
// 4-я личная Интернет-олимпиада сезона 2009/2010
// Автор задачи: Павел Маврин, ?@?.?
// Автор решения: Маским Носенко, nosenkomax@gmail.com

import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class hotel_mn implements Runnable {

	public static void main(String args[]) {
		new Thread(new hotel_mn()).start();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	private String FNAME = "hotel";
	boolean eof = false;

	@Override
	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			br.close();
			out.close();

		} catch (Exception e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	void My_Assert(boolean b, String s) {
		if (!b)
			throw new Error("Assertion " + s);
	}

	int[][] d;

	int n, m;

	private void solve() {
		n = nextInt();
		m = nextInt();
		char[][] c = new char[n][m];
		for (int i = 0; i < n; i++) {
			c[i] = nextToken().toCharArray();
			My_Assert(c[i].length == m, "Not enough or too much symbols, needed: " + m + ", found: " + c[i].length);
		}	

		My_Assert(3 <= n && n <= 30, "n is out of range: " + n);
		My_Assert(3 <= m && m <= 30, "m is out of range: " + m);
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				My_Assert(c[i][j] == '.' || c[i][j] == '*', "Wrong symbol: " + c[i][j]);

		d = new int[n][m];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (c[i][j] == '*') {
					d[i][j] = -666;

				} else
					d[i][j] = -1;

		int num = 0;

		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (d[i][j] == -1) {
					dfs(i, j, num);
					num++;
				}

		int[][] min, max;
		min = new int[num][2];
		max = new int[num][2];
		for (int i = 0; i < num; i++) {
			min[i][0] = min[i][1] = Integer.MAX_VALUE;
			max[i][0] = max[i][1] = Integer.MIN_VALUE;
		}

		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				if (d[i][j] >= 0) {
					int t = d[i][j];
					min[t][0] = min(min[t][0], i);
					min[t][1] = min(min[t][1], j);

					max[t][0] = max(max[t][0], i);
					max[t][1] = max(max[t][1], j);
				}

		int ans = -1;


		for (int i = 0; i < num; i++)
			if (doCheck(min[i][0], min[i][1], max[i][0], max[i][1], i)) {
				ans = max(ans, (max[i][0] - min[i][0] + 1)
						* (max[i][1] - min[i][1] + 1));
			} else {
				My_Assert(false, "Bad input - check cell " + min[i][0] + " " + min[i][1]);
			}

		out.println(ans);

	}

	private boolean doCheck(int x1, int y1, int x2, int y2, int c) {

		for (int i = x1; i <= x2; i++)
			for (int j = y1; j <= y2; j++)
				if (d[i][j] != c)
					return false;
		return true;
	}

	private void dfs(int i, int j, int c) {
		if (i < 0 || i == n || j < 0 || j == m || d[i][j] != -1)
			return;
		d[i][j] = c;
		dfs(i, j - 1, c);
		dfs(i, j + 1, c);
		dfs(i - 1, j, c);
		dfs(i + 1, j, c);
	}
}