#include <bits/stdc++.h>
using namespace std;
bool wayToSort(char i, char j) { return i > j; }
bool visited[20005][11];
vector<long long> v;
long long total[20005], msg[20005];
int main() {
  long long n, minn, maxx, k, count = 0, m, x = 105, y = -1;
  memset(visited, 0, sizeof(visited));
  memset(total, 0, sizeof(total));
  scanf("%lld %lld %lld", &n, &m, &k);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      scanf("%lld", &visited[i][j]);
    }
  }
  for (long long i = 0; i < k; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    a--;
    b--;
    total[a]--;
    msg[b]++;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      total[i] += (visited[i][j] * msg[j]);
    }
    printf("%lld", total[i]);
    if (i < n - 1) {
      printf(" ");
    } else
      printf("\n");
  }
  return 0;
}
