#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  long long d[n + 1], cnt[n + 1], cost[n + 1], par[n + 1];
  for (long long i = 1; i <= n; i++) {
    cnt[i] = 0;
    par[i] = -1;
    d[i] = 1e18;
    cost[i] = 1e18;
  }
  d[1] = 0;
  vector<pair<long long, pair<long long, long long>>> g[n + 1];
  for (long long i = 1; i <= m; i++) {
    long long u, v, x;
    cin >> u >> v >> x;
    g[u].push_back({v, {x, 0}});
    g[v].push_back({u, {x, 0}});
  }
  for (long long i = 1; i <= k; i++) {
    long long s, y;
    cin >> s >> y;
    cnt[s]++;
    cost[s] = min(cost[s], y);
  }
  for (long long i = 2; i <= n; i++) {
    if (!cnt[i]) continue;
    g[i].push_back({1, {cost[i], 1}});
    g[1].push_back({i, {cost[i], 1}});
  }
  set<pair<long long, long long>> pq;
  pq.insert({d[1], 1});
  while (!pq.empty()) {
    auto x = (*pq.begin());
    long long v = x.second;
    pq.erase(x);
    for (auto it : g[v]) {
      long long u = it.first, wt = it.second.first, type = it.second.second;
      if (d[u] > d[v] + wt) {
        pq.erase({d[u], u});
        d[u] = d[v] + wt;
        pq.insert({d[u], u});
        par[u] = type;
      } else if (d[u] == d[v] + wt) {
        if (!par[u]) continue;
        if (par[u] == 1) par[u] = type;
      }
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (cnt[i]) ans = ans + cnt[i] - par[i];
  }
  cout << ans;
  return 0;
}
