#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, i, j, k, x, y;
  cin >> n >> m >> k;
  vector<vector<int>> v(n + 1, vector<int>(m + 1));
  vector<int> sent(n + 1, 0), ans(n + 1, 0), msg(m + 1, 0);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) cin >> v[i][j];
  }
  while (k--) {
    cin >> x >> y;
    sent[x]++;
    msg[y]++;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) ans[i] += v[i][j] * msg[j];
    ans[i] -= sent[i];
    cout << ans[i] << " ";
  }
  cout << "\n";
  return 0;
}
