// eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF  1023456789LL
#define INF16 10000000000000000LL
#define eps 1e-9
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
#ifndef ONLINE_JUDGE
#define debug(...) printf(__VA_ARGS__)
#else 
#define debug(...)
#endif
inline LL getint(){
  LL _x=0,_tmp=1; char _tc=getchar();    
  while( (_tc<'0'||_tc>'9')&&_tc!='-' ) _tc=getchar();
  if( _tc == '-' ) _tc=getchar() , _tmp = -1;
  while(_tc>='0'&&_tc<='9') _x*=10,_x+=(_tc-'0'),_tc=getchar();
  return _x*_tmp;
}
inline LL add( LL _x , LL _y , LL _mod = mod7 ){
  _x += _y;
  return _x >= _mod ? _x - _mod : _x;
}
inline LL sub( LL _x , LL _y , LL _mod = mod7 ){
  _x -= _y;
  return _x < 0 ? _x + _mod : _x;
}
inline LL mul( LL _x , LL _y , LL _mod = mod7 ){
  _x *= _y;
  return _x >= _mod ? _x % _mod : _x;
}
LL mypow( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 1LL;
  LL _ret = mypow( mul( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = mul( _ret , _a , _mod );
  return _ret;
}
LL mymul( LL _a , LL _x , LL _mod ){
  if( _x == 0 ) return 0LL;
  LL _ret = mymul( add( _a , _a , _mod ) , _x >> 1 , _mod );
  if( _x & 1 ) _ret = add( _ret , _a , _mod );
  return _ret;
}
inline bool equal( D _x ,  D _y ){
  return _x > _y - eps && _x < _y + eps;
}
#define Bye exit(0)
int __ = 1 , _cs;
/*********default*********/
#define N 2222
void build(){

}
int n , m , q;
char c[ N ][ N ];
int s[ N ][ N ];
void init(){
  n = getint();
  m = getint();
  q = getint();
  for( int i = 1 ; i <= n ; i ++ ){
    scanf( "%s" , c[ i ] + 1 );
    for( int j = 1 ; j <= m ; j ++ )
      s[ i ][ j ] = s[ i - 1 ][ j ] +
                    s[ i ][ j - 1 ] -
                    s[ i - 1 ][ j - 1 ] +
                    c[ i ][ j ] - '0';
  }
}
int dplr[ N ][ N ] , dpud[ N ][ N ];
void solve(){
  for( int i = 1 ; i <= n ; i ++ )
    for( int j = 1 ; j <= m ; j ++ ){
      if( c[ i ][ j ] == '0' ) continue;
      if( i + 1 <= n and c[ i + 1 ][ j ] == '1' )
        dpud[ i ][ j ] ++;
      if( j + 1 <= m and c[ i ][ j + 1 ] == '1' )
        dplr[ i ][ j ] ++;
    }
  for( int i = 1 ; i <= n ; i ++ )
    for( int j = 1 ; j <= m ; j ++ ){
      dpud[ i ][ j ] += dpud[ i - 1 ][ j ] +
                        dpud[ i ][ j - 1 ] -
                        dpud[ i - 1 ][ j - 1 ];
      dplr[ i ][ j ] += dplr[ i - 1 ][ j ] +
                        dplr[ i ][ j - 1 ] -
                        dplr[ i - 1 ][ j - 1 ];
    }
  while( q -- ){
    int n1 = getint();
    int m1 = getint();
    int n2 = getint();
    int m2 = getint();
    int ans = s[ n2 ][ m2 ]
              - s[ n1 - 1 ][ m2 ]
              - s[ n2 ][ m1 - 1 ]
              + s[ n1 - 1 ][ m1 - 1 ];
    if( n1 < n2 ){
      ans -= dpud[ n2 - 1 ][ m2 ] -
             dpud[ n1 - 1 ][ m2 ] -
             dpud[ n2 - 1 ][ m1 - 1 ] +
             dpud[ n1 - 1 ][ m1 - 1 ];
    }
    if( m1 < m2 ){
      ans -= dplr[ n2     ][ m2 - 1 ] -
             dplr[ n1 - 1 ][ m2 - 1 ] -
             dplr[ n2     ][ m1 - 1 ] +
             dplr[ n1 - 1 ][ m1 - 1 ];
    }
    printf( "%d\n" , ans );
  }
}
int main(){
  build();
  //__ = getint();
  while( __ -- ){
    init();
    solve();
  }
}


Measured memory_bytes: 64000