#include <iostream>
#include <vector>
void answer ( int count )
{
std::cout << count << std::endl;
}
const int Y_SIZE = 300;
const int X_SIZE = 300;
int H; // ホーム画面縦の区画数
int W; // ホーム画面横の区画数
std::vector< std::vector<int> > array ( Y_SIZE , std::vector<int> ( X_SIZE ) ); // ホーム画面の配置
void resolve (
int S /* ウィジェットの縦サイズ */ ,
int T /* ウィジェットの横サイズ */ )
{
// your code goes here
}
int main ()
{
std::string str;
int N, s, t;
int x, y, i;
std::cin >> H >> W;
for ( y = 0 ; y < H ; y++ )
{
std::cin >> str;
for ( x = 0 ; x < W ; x++ )
{
array[ y ][ x ] = int( str[ x ] - '0' );
}
}
std::cin >> N;
for ( i = 0 ; i < N ; i++ )
{
std::cin >> s >> t;
resolve( s , t );
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdm9pZCBhbnN3ZXIgKCBpbnQgY291bnQgKQp7CglzdGQ6OmNvdXQgPDwgY291bnQgPDwgc3RkOjplbmRsOwp9Cgpjb25zdCBpbnQgWV9TSVpFID0gMzAwOwpjb25zdCBpbnQgWF9TSVpFID0gMzAwOwoKaW50IEg7IC8vIOODm+ODvOODoOeUu+mdoue4puOBruWMuueUu+aVsAppbnQgVzsgLy8g44Ob44O844Og55S76Z2i5qiq44Gu5Yy655S75pWwCnN0ZDo6dmVjdG9yPCBzdGQ6OnZlY3RvcjxpbnQ+ID4gYXJyYXkgKCBZX1NJWkUgLCBzdGQ6OnZlY3RvcjxpbnQ+ICggWF9TSVpFICkgKTsgLy8g44Ob44O844Og55S76Z2i44Gu6YWN572uCgp2b2lkIHJlc29sdmUgKAoJaW50IFMgLyog44Km44Kj44K444Kn44OD44OI44Gu57im44K144Kk44K6ICovICwKCWludCBUIC8qIOOCpuOCo+OCuOOCp+ODg+ODiOOBruaoquOCteOCpOOCuiAqLyApCnsKCS8vIHlvdXIgY29kZSBnb2VzIGhlcmUKfQogCmludCBtYWluICgpCnsKCXN0ZDo6c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