#include <bits/stdc++.h>
using namespace std;
 
#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define debug(x) cerr << #x " = " << (x) << '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
 
lli MOD  = 1000000007;
lli inf = 1e15;
 
void scan(scantype &x);

lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli div(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

bool isprime(long long int n)
{
    if(n ==1 )
        return false;
    if(n == 2)
        return true;
    for(long long int i =2;i<=n/i;i++)
    {
        if(n%i == 0)
            return false;
    }
    return true;
}

int a[2001][2001];
int nod[2001][2001];
int e[2001][2001];
int v[2001][2001];
int h[2001][2001];


int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);   
    int t;
    t = 1;
    while(t--)
    {
        int n,m,q;
        cin>>n>>m>>q;
        // int a[n+1][m+1];
        // fill(a,0);
        // int e[n+1][m+1];
        // fill(e,0);
        for(int i = 1;i<=n;i++)
        {
            string s;
            cin>>s;
            int j = 1;
            for(auto ii : s)
            {
                a[i][j++] = ii-'0';
            }
        }
      
        // int nod[n+1][m+1];
        // fill(nod,0);
        // int h[n+1][m+1];
        // fill(h,0);
        // int v[n+1][m+1];
        // fill(v,0);
        for(int i = 1;i<=n;i++)
        {
            for(int j = 1;j<=m;j++)
            {
                e[i][j] = e[i][j-1] + e[i-1][j] - e[i-1][j-1];
                if(a[i][j] == a[i-1][j] && a[i][j] == 1)
                    e[i][j]++;
                if(a[i][j] == a[i][j-1] && a[i][j] == 1)
                    e[i][j]++;
                nod[i][j] = a[i][j] + nod[i][j-1] + nod[i-1][j] - nod[i-1][j-1];
                v[i][j] = v[i-1][j];
                h[i][j] = h[i][j-1];
                if(a[i][j] == a[i][j-1] && a[i][j] == 1)
                    v[i][j]++;
                if(a[i][j] == a[i-1][j] && a[i][j] == 1)
                    h[i][j]++;

            }
        }
        //  for(int i = 1;i<=n;i++)
        // {
        //     for(int j = 1;j<=m;j++)
        //     {
        //         cout<<e[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        // cout<<endl;
        // for(int i = 1;i<=n;i++)
        // {
        //     for(int j = 1;j<=m;j++)
        //     {
        //         cout<<nod[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        while(q--)
        {
            int r1,r2,c1,c2;
            cin>>r1>>c1>>r2>>c2;
            int no = nod[r2][c2] - nod[r1-1][c2] - nod[r2][c1-1] + nod[r1-1][c1-1];
            int ee = e[r2][c2] - e[r1-1][c2] - e[r2][c1-1] + e[r1-1][c1-1];
            ee -= h[r1][c2]-h[r1][c1-1];
            ee -= v[r2][c1] - v[r1-1][c1];
            cout<<no-ee<<endl;
        }

    }    



    
    return 0;    
}
 

void scan(scantype &x)
{
    register int c = getchar(); //for negative/positive
    x = 0;
    int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = getchar());
    if(c=='-') {neg=1;c=getchar();}
    for(;c>47 && c<58;c = getchar()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}


Measured memory_bytes: 80000