#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll R,C,Q, grid[2005][2005], node[2005][2005], edge[4005][4005], grid2[4005][4005];
int main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin>>R>>C>>Q;
    for (ll i=1; i<=R; i++){
        for (ll j=1; j<=C; j++){
            char a; cin>>a;
            grid[i][j] = a-'0';
        }
    }
    for (ll i=1; i<=R; i++){
        for (ll j=1; j<=C; j++){
            node[i][j]= grid[i][j] + node[i-1][j] + node[i][j-1] - node[i-1][j-1];
        }
    }
    for (ll i=1; i<=R; i++){
        for (ll j=1; j<=C; j++){
            if (grid[i][j]==1){
                if (grid[i-1][j]==1){
                    grid2[2*i -2][2*j -1]=1;
                }
                if (grid[i+1][j]==1){
                    grid2[2*i][2*j -1]=1;
                }
                if (grid[i][j-1]==1){
                    grid2[2*i -1][2*j -2]=1;
                }
                if (grid[i][j+1]==1){
                    grid2[2*i -1][2*j ]=1;
                }
                
            }
        }
    }
    for (ll i=1; i<=2*R; i++){
        for (ll j=1; j<=2*C; j++){
            edge[i][j]= grid2[i][j] + edge[i-1][j] + edge[i][j-1] - edge[i-1][j-1];
        }
    }

    for (ll i=1; i<=Q; i++){
        ll r1,c1,r2,c2,k1,k2;
        cin >> r1 >> c1 >> r2 >> c2;
        k1= node[r2][c2]-node[r2][c1-1]-node[r1-1][c2]+node[r1-1][c1-1];
        k2= edge[2*r2 -1][2*c2 -1] + edge[2*r1 - 2][2*c1 - 2] - edge[2*r2 -1][2*c1 -2] - edge[2*r1 -2][2*c2 -1];
        cout << k1-k2 << "\n";
    }
}