#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > path[300005];
int N, M, K, cnt;
long long a, b, c, rail[300005], INF = (1ull << 60);
bool visit[300005];
priority_queue<pair<long long, long long> > q;
void solve() {
  pair<long long, long long> pll, n;
  long long v, w;
  q.push(make_pair(0, 1));
  while (!q.empty()) {
    n = q.top();
    q.pop();
    v = n.second;
    w = n.first;
    if (v <= 0) {
      v += N;
      if (visit[v]) cnt++;
    }
    if (visit[v]) continue;
    visit[v] = 1;
    for (int i = 0; i < path[v].size(); i++) {
      pll = path[v][i];
      q.push(make_pair(pll.second + w, pll.first));
    }
  }
}
int main() {
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 0; i < M; i++) {
    scanf("%I64d %I64d %I64d", &a, &b, &c);
    path[a].push_back(make_pair(b, -c));
    path[b].push_back(make_pair(a, -c));
  }
  for (int i = 0; i < K; i++) {
    scanf("%I64d %I64d", &a, &b);
    q.push(make_pair(-b, a - N));
  }
  solve();
  printf("%d", cnt);
}
