#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, i, j, x, y, total[15] = {0}, emp[20009] = {0}, a[20009][15];
  cin >> n;
  cin >> m;
  cin >> k;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  for (i = 1; i <= k; i++) {
    scanf("%d %d", &x, &y);
    emp[x]--;
    total[y]++;
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) emp[i] += a[i][j] * total[j];
  for (i = 1; i <= n; i++) printf("%d ", emp[i]);
  printf("\n");
  return 0;
}
