#include <bits/stdc++.h>
using namespace std;
long long n, m, z, a, b, c, nr;
long long mnr[300005], mn[300005], uz[300005];
const long long INF = 1e17;
vector<pair<long long, long long> > v[300005], H;
bool comp(pair<long long, long long> a, pair<long long, long long> b) {
  if (min(a.second, mnr[a.first]) == min(b.second, mnr[b.first]))
    return a.second > b.second;
  return min(a.second, mnr[a.first]) > min(b.second, mnr[b.first]);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> z;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b >> c;
    v[a].push_back({b, c});
    v[b].push_back({a, c});
  }
  for (int i = 1; i <= n; i++) mn[i] = mnr[i] = INF;
  for (int i = 1; i <= z; i++) {
    cin >> a >> c;
    if (mnr[a] < INF) nr++;
    mnr[a] = min(mnr[a], (long long)c);
  }
  for (int i = 1; i <= n; i++) {
    if (mnr[i] < INF) {
      H.push_back({i, INF});
    }
  }
  mn[1] = 0;
  H.push_back({1, 0});
  make_heap(H.begin(), H.end(), comp);
  while (!H.empty()) {
    pair<long long, long long> crt = H[0];
    pop_heap(H.begin(), H.end(), comp);
    H.pop_back();
    if (crt.second > mn[crt.first]) continue;
    if (mnr[crt.first] < INF && mnr[crt.first] >= crt.second && !uz[crt.first])
      nr++, uz[crt.first] = 1;
    if (mnr[crt.first] < crt.second)
      crt.second = mn[crt.first] = mnr[crt.first];
    for (auto it : v[crt.first]) {
      if (mn[it.first] > it.second + crt.second) {
        mn[it.first] = it.second + crt.second;
        H.push_back({it.first, mn[it.first]});
        push_heap(H.begin(), H.end(), comp);
      }
    }
  }
  cout << nr << '\n';
  return 0;
}
