#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, temp1, temp2;
  cin >> n >> m >> k;
  int derp[n][m];
  int chats[m];
  int count[n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> derp[i][j];
    }
  }
  for (int i = 0; i < m; i++) {
    chats[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    count[i] = 0;
  }
  for (int i = 0; i < k; i++) {
    cin >> temp1 >> temp2;
    count[temp1 - 1]--;
    chats[temp2 - 1]++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      count[i] += derp[i][j] * chats[j];
    }
    if (i == 0) {
      cout << count[i];
    } else {
      cout << " " << count[i];
    }
  }
  cout << endl;
}
