#include <cstdio>
#define MN 2010

int n, m, q; 
char s[MN][MN];
int p[MN][MN], r[MN][MN], c[MN][MN]; 

int main()
{
	scanf("%d%d%d", &n, &m, &q);
	for(int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= m; j++)
		{
			p[i][j] = p[i - 1][j] + p[i][j - 1] - p[i - 1][j - 1] + s[i][j] - '0';
			r[i][j] = r[i - 1][j] + r[i][j - 1] - r[i - 1][j - 1] + (s[i][j] == '1' && s[i][j - 1] == '1');
			c[i][j] = c[i - 1][j] + c[i][j - 1] - c[i - 1][j - 1] + (s[i][j] == '1' && s[i - 1][j] == '1');
		}
	for(int i = 1; i <= q; i++)
	{
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		int P = p[c][d] - p[c][b - 1] - p[a - 1][d] + p[a - 1][b - 1];
		int R = r[c][d] - r[c][b] - r[a - 1][d] + r[a - 1][b];
		int C = ::c[c][d] - ::c[c][b - 1] - ::c[a][d] + ::c[a][b - 1];
		printf("%d\n", P - R - C);
	}
	return 0;
}