#include <bits/stdc++.h>
using namespace std;
void optimizeIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const long long inf = 1LL << 61;
vector<vector<pair<long long, long long> > > G;
bool train[200002] = {false};
long long dist[200002];
long long n, m, t;
void dijk(int s) {
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  dist[s] = 0;
  for (int i = 1; i <= n; i++)
    if (dist[i] != inf) pq.push(make_pair(dist[i], i));
  while (!pq.empty()) {
    pair<long long, long long> p = pq.top();
    pq.pop();
    long long d = p.first;
    long long u = p.second;
    if (dist[u] < d) continue;
    for (int i = 0; i < (int)G[u].size(); i++) {
      long long v = G[u][i].second;
      long long dv = G[u][i].first;
      if (dist[v] >= dist[u] + dv)
        if (train[v]) train[v] = false;
      if (dist[v] > dist[u] + dv) {
        dist[v] = dist[u] + dv;
        pq.push(make_pair(dist[v], v));
      }
    }
  }
}
int main() {
  optimizeIO();
  cin >> n >> m >> t;
  G.resize(n + 1);
  for (int i = 0; i <= n; i++) {
    dist[i] = inf;
    train[i] = false;
  }
  for (long long i = 0; i < m; i++) {
    int x, y;
    long long w;
    cin >> x >> y >> w;
    G[x].push_back(make_pair(w, y));
    G[y].push_back(make_pair(w, x));
  }
  for (long long i = 0; i < t; i++) {
    long long x, y;
    cin >> x >> y;
    train[x] = true;
    dist[x] = min(dist[x], y);
  }
  dijk(1);
  long long ans = t;
  for (long long i = 1; i <= n; i++)
    if (train[i]) ans--;
  cout << ans << endl;
  return 0;
}
