#include <cstdio>
#include <cstring>
#define rep(i,j,k) for (i=j;i<=k;i++)
using namespace std;
const int N=4e3+5;
int b[N][N];
char s[N][N];
int n,m,q,x1,y1,x2,y2,i,j,ans;
int main()
{
//	freopen("grid.in","r",stdin);
//	freopen("grid.out","w",stdout);
	scanf("%d%d%d",&n,&m,&q);
	rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n)
		rep(j,1,m)
		{
			if (s[i][j]!='1') continue;
			b[i*2-1][j*2-1]=1;
			if (i+1<=n && s[i+1][j]=='1') b[i*2][j*2-1]=-1;
			if (j+1<=m && s[i][j+1]=='1') b[i*2-1][j*2]=-1;
		}
	rep(i,1,n*2-1)
		rep(j,1,m*2-1)
			b[i][j]+=b[i-1][j]+b[i][j-1]-b[i-1][j-1];
	rep(i,1,q)
	{
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		x1=x1*2-1; y1=y1*2-1; x2=x2*2-1; y2=y2*2-1;
		ans=b[x2][y2]-b[x1-1][y2]-b[x2][y1-1]+b[x1-1][y1-1];
		printf("%d\n",ans);
	}
	return 0;
}