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