#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n + 1][m + 1];
  int su[n + 1];
  int powe[m + 1];
  for (int i = 1; i <= n; i++) {
    su[i] = 0;
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      powe[j] = 0;
    }
  }
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    powe[y]++;
    su[x]--;
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) su[j] += a[j][i] * powe[i];
  }
  for (int i = 1; i <= n; i++) cout << su[i] << " ";
  return 0;
}
