#include <bits/stdc++.h>
using namespace std;
int n, m, dist[300001], f[300001];
vector<pair<int, int> > g[300001];
priority_queue<pair<long long, int> > q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int x = 0, y = 0, w = 0, v = 0, ss = 0, ans = 0, to = 0;
  cin >> n >> m >> ss;
  for (int i = 0; i < n; i++) dist[i] = 1e9;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> w;
    x--;
    y--;
    g[x].push_back({y, w});
    g[y].push_back({x, w});
  }
  for (int i = 0; i < ss; i++) {
    cin >> y >> w;
    y--;
    dist[y] = min(dist[y], w);
    if (dist[y] == 0) dist[y] = w;
    f[y] = 1;
  }
  q.push({0, 0});
  for (int i = 0; i < n; i++)
    if (f[i]) q.push({-dist[i], i});
  dist[0] = 0;
  while (!q.empty()) {
    v = q.top().second;
    w = -q.top().first;
    q.pop();
    if (dist[v] < w) continue;
    for (int i = 0; i < g[v].size(); i++) {
      to = g[v][i].first;
      w = g[v][i].second;
      if (dist[to] >= dist[v] + w) {
        f[to] = 0;
        if (dist[to] == dist[v] + w) continue;
        dist[to] = dist[v] + w;
        q.push({-dist[to], to});
      }
    }
  }
  for (int i = 0; i < n; i++) ans += f[i];
  cout << ss - ans;
}
