#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int to, w, type;
  Edge() {}
  Edge(int _to, int _w, int _type) : to(_to), w(_w), type(_type) {}
  bool operator<(const Edge other) { return type < other.type; }
};
const long long N = 1e5 + 5, oo = 1e18;
long long n, m, k, dist[N], res;
int deg[N];
vector<Edge> adj[N];
bool mark[N];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  clock_t tStart = clock();
  cin >> n >> m >> k;
  for (long long huy = 0, _n = (m); huy < _n; huy++) {
    long long u, v, w;
    cin >> u >> v >> w;
    adj[u].push_back(Edge(v, w, 0));
    adj[v].push_back(Edge(u, w, 0));
  }
  for (long long nene = 0, _n = (k); nene < _n; nene++) {
    long long v, t;
    cin >> v >> t;
    adj[1].push_back(Edge(v, t, 1));
    adj[v].push_back(Edge(1, t, 1));
  }
  set<pair<long long, long long> > pq;
  pq.clear();
  pq.insert(pair<long long, long long>(0, 1));
  for (long long i = (2), _b = (n); i <= _b; i++) dist[i] = oo;
  while (!pq.empty()) {
    pair<long long, long long> front = *(pq.begin());
    long long d = front.first, u = front.second;
    pq.erase(pq.begin());
    if (d > dist[u]) continue;
    for (Edge e : adj[u])
      if (dist[u] + e.w < dist[e.to]) {
        dist[e.to] = dist[u] + e.w;
        pq.insert(pair<long long, long long>(dist[e.to], e.to));
      }
  }
  for (long long u = (1), _b = (n); u <= _b; u++)
    for (Edge e : adj[u]) {
      if (dist[u] + e.w == dist[e.to]) {
        deg[e.to]++;
      }
    }
  res = k;
  for (long long u = (1), _b = (n); u <= _b; u++)
    for (Edge e : adj[u]) {
      if (e.type == 1 && dist[u] + e.w == dist[e.to]) {
        if (deg[e.to] == 1) res--;
        deg[e.to]--;
      }
    }
  cout << res << '\n';
  fprintf(stderr, "Time taken: %.2fs\n",
          (double)(clock() - tStart) / CLOCKS_PER_SEC);
  return 0;
}
