#include <bits/stdc++.h>
using namespace std;
int t[100000][11];
int recibos[11];
int envios[100000];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> t[i][j];
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    envios[x]++;
    recibos[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) cout << " ";
    int sol = -envios[i];
    for (int j = 1; j <= m; j++) sol += recibos[j] * t[i][j];
    cout << sol;
  }
  cout << endl;
}
