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