#include <bits/stdc++.h>
using namespace std;
long long rPow(long long n, long long k) {
  if (k <= 0) return 1;
  return n * rPow(n, --k);
}
long long binaryNum[1000];
void decToBinary(int n) {
  long long i = 0;
  while (n > 0) {
    binaryNum[i] = n % 2;
    n = n / 2;
    i++;
  }
}
long long inf = 1e18;
long long n, m, k;
vector<pair<long long, long long> > g[300100];
vector<pair<long long, long long> > route;
long long dist[300300];
vector<long long> path;
long long numedges[300100];
long long dik() {
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      q;
  for (int i = 0; i <= n; i++) dist[i] = inf;
  dist[1] = 0;
  numedges[1] = 1;
  for (int i = 0; i < k; i++) {
    dist[route[i].first] = min(route[i].second, dist[route[i].first]);
    numedges[route[i].first] = 1;
  }
  for (int i = 1; i <= n; i++) {
    if (dist[i] == inf) continue;
    q.push({dist[i], i});
  }
  while (!q.empty()) {
    pair<long long, long long> t = q.top();
    long long u = t.second;
    long long w = t.first;
    q.pop();
    if (dist[u] < w) continue;
    for (int i = 0; i < g[u].size(); i++) {
      int nxt = g[u][i].second;
      int we = g[u][i].first;
      if (dist[nxt] < w + we)
        continue;
      else if (dist[nxt] == (w + we))
        numedges[nxt]++;
      else if (w + we < dist[nxt]) {
        numedges[nxt] = 1;
        dist[nxt] = w + we;
        q.push(make_pair(dist[nxt], nxt));
      }
    }
  }
  long long del = 0;
  for (int i = 0; i < route.size(); i++) {
    if (dist[route[i].first] == route[i].second &&
        numedges[route[i].first] == 1) {
      dist[route[i].first] = inf;
      continue;
    } else if (dist[route[i].first] != route[i].second ||
               numedges[route[i].first] != 1) {
      del++;
    }
  }
  return del;
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    long long a, b, w;
    cin >> a >> b >> w;
    g[a].push_back(make_pair(w, b));
    g[b].push_back(make_pair(w, a));
  }
  for (int i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    route.push_back(make_pair(a, b));
  }
  sort(route.begin(), route.end());
  cout << dik() << endl;
  return 0;
}
