#include <bits/stdc++.h>
using namespace std;
long long dist[300005];
bool tr[300005];
vector<pair<long long, long long> > v[300005];
long long ans = 0;
priority_queue<pair<long long, long long> > s;
void dijkstra() {
  long long x, y, second, e;
  while (!s.empty()) {
    pair<long long, long long> p = s.top();
    s.pop();
    e = p.first;
    if (dist[e] != -p.second) continue;
    for (int i = 0; i < v[e].size(); i++) {
      x = v[e][i].first;
      second = v[e][i].second;
      if (dist[e] + second <= dist[x] && tr[x]) {
        tr[x] = false;
      }
      if (dist[e] + second < dist[x]) {
        dist[x] = dist[e] + second;
        s.push({x, -dist[x]});
      }
    }
  }
}
int main() {
  long long m, n, x, y, second, k;
  scanf("%lld%lld%lld", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%lld%lld%lld", &x, &y, &second);
    v[x].push_back({y, second});
    v[y].push_back({x, second});
  }
  for (int i = 0; i <= n; i++) {
    dist[i] = 1e18;
    tr[i] = false;
  }
  dist[0] = 0;
  dist[1] = 0;
  ans = k;
  for (int i = 1; i <= k; i++) {
    scanf("%lld%lld", &y, &second);
    tr[y] = true;
    dist[y] = min(dist[y], second);
  }
  for (int i = 0; i <= n; i++) {
    if (dist[i] != 1e18) {
      s.push({i, -dist[i]});
    }
  }
  dijkstra();
  for (int i = 0; i <= n; i++)
    if (tr[i]) ans--;
  printf("%lld", ans);
  return 0;
}
