#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
multiset<pair<long, long> > g[300002];
vector<long long> dist(300002, 1000000007);
vector<long long> train(300002, 1000000007);
vector<bool> nt(300002, false);
vector<bool> used(300002, false);
long long dijkstra() {
  long long res = 0;
  set<pair<long, long> > s;
  s.insert(make_pair(0, 1));
  dist[1] = 0;
  nt[1] = false;
  for (int i = 2; i <= n; i++) s.insert(make_pair(dist[i], i));
  while (!s.empty()) {
    long long cur = s.begin()->second;
    s.erase(s.begin());
    used[cur] = true;
    if (nt[cur]) ++res;
    for (pair<long long, long long> next : g[cur])
      if (!used[next.first] && dist[next.first] >= dist[cur] + next.second) {
        s.erase(make_pair(dist[next.first], next.first));
        dist[next.first] = dist[cur] + next.second;
        nt[next.first] = false;
        s.insert(make_pair(dist[next.first], next.first));
      }
  }
  return res;
}
void initialization() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    long long a, b, c;
    cin >> a >> b >> c;
    g[a].insert(make_pair(b, c));
    g[b].insert(make_pair(a, c));
  }
  for (int i = 0; i < k; ++i) {
    long long b, c;
    cin >> b >> c;
    train[b] = min(train[b], c);
    dist[b] = train[b];
    if (dist[b] < 1000000007) nt[b] = true;
  }
}
void solve() {}
void print() { cout << k - dijkstra(); }
int main() {
  ios::sync_with_stdio(0);
  initialization();
  solve();
  print();
  return 0;
}
