#include <bits/stdc++.h>
#pragma GCC optimise("Ofast", "unroll-loops)
using namespace std;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  long long a[n][m], b[n * m + 3], c[n][m];
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  memset(c, 0, sizeof(c));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    b[y]++;
    c[x][y]++;
  }
  for (int i = 0; i < n - 1; i++) {
    long long ans = 0;
    for (int j = 0; j < m; j++) {
      if (a[i][j] == 1) {
        ans += (b[j] - c[i][j]);
      }
    }
    cout << ans << " ";
  }
  long long ans = 0;
  for (int j = 0; j < m; j++) {
    if (a[n - 1][j] == 1) {
      ans += (b[j] - c[n - 1][j]);
    }
  }
  cout << ans;
  return;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
