#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > edge[1 << 20];
long long dist[1 << 20];
set<pair<long long, long long> > g[1 << 20];
bool visit[1 << 20];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++) {
    long long a, b, x;
    cin >> a >> b >> x;
    edge[a].push_back(make_pair(b, x));
    edge[b].push_back(make_pair(a, x));
  }
  long long cnt = 0;
  for (long long i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    g[a].insert(make_pair(b, cnt));
    cnt++;
  }
  for (long long i = 0; i <= n; i++) {
    dist[i] = LLONG_MAX;
  }
  priority_queue<pair<long long, pair<long long, long long> >,
                 vector<pair<long long, pair<long long, long long> > >,
                 greater<pair<long long, pair<long long, long long> > > >
      q;
  q.push(make_pair(0, make_pair(1, 0)));
  dist[1] = 0;
  for (long long i = 1; i <= n; i++) {
    if (g[i].size()) {
      for (set<pair<long long, long long> >::iterator p = g[i].begin();
           p != g[i].end(); p++) {
        q.push(make_pair(p->first, make_pair(i, 1)));
        dist[i] = min(dist[i], p->first);
      }
    }
  }
  long long ans = 0;
  while (q.size()) {
    pair<long long, pair<long long, long long> > p = q.top();
    q.pop();
    long long v = p.second.first, d = p.first;
    if (visit[v]) {
      if (p.second.second) ans++;
      continue;
    }
    visit[v] = 1;
    for (long long i = 0; i < edge[v].size(); i++) {
      long long u = edge[v][i].first, x = edge[v][i].second;
      if (visit[u]) {
        continue;
      } else if (dist[u] >= dist[v] + x) {
        dist[u] = dist[v] + x;
        q.push(make_pair(dist[u], make_pair(u, 0)));
      }
    }
  }
  cout << ans;
}
