#include <bits/stdc++.h>
using namespace std;
struct grp {
  long long to, wt, edgeCode;
  char type;
};
struct Node {
  long long x, dis;
};
struct comp {
  inline bool operator()(const Node& n1, const Node& n2) const {
    if (n1.dis != n2.dis) return n1.dis < n2.dis;
    return n1.x < n2.x;
  }
};
void dijkstra(long long n, vector<vector<grp> >& edges, vector<long long>& dis,
              vector<bool>& visited, vector<pair<long long, long long> >& par) {
  set<Node, comp> myset;
  for (long long i = 1; i <= n; ++i) {
    Node node;
    node.x = i, node.dis = dis[i];
    myset.insert(node);
  }
  while (myset.size()) {
    set<Node>::iterator it = myset.begin();
    Node node = *it;
    myset.erase(it);
    visited[node.x] = true;
    for (long long i = 0; i < edges[node.x].size(); ++i) {
      grp& edge = edges[node.x][i];
      if (visited[edge.to]) {
        continue;
      }
      long long newDis = dis[node.x] + edge.wt;
      if (newDis < dis[edge.to] ||
          (newDis == dis[edge.to] && edge.type == 'r')) {
        Node prevNode, newNode;
        prevNode.x = edge.to, prevNode.dis = dis[edge.to];
        newNode.x = edge.to, newNode.dis = newDis;
        dis[edge.to] = newDis;
        par[edge.to] = {node.x, edge.edgeCode};
        myset.erase(myset.find(prevNode));
        myset.insert(newNode);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, k;
  cin >> n >> m >> k;
  vector<vector<grp> > edges(n + 1);
  long long edgeCode = 0;
  for (long long i = 0; i < m; i++) {
    long long x, y, w;
    cin >> x >> y >> w;
    grp g;
    g.to = y, g.wt = w, g.type = 'r', g.edgeCode = edgeCode++;
    edges[x].push_back(g);
    g.to = x, g.edgeCode = edgeCode++;
    edges[y].push_back(g);
  }
  vector<pair<long long, long long> > trainPaths(k);
  for (long long i = 0; i < k; ++i) {
    long long y, w;
    cin >> y >> w;
    trainPaths[i] = {y, edgeCode};
    grp g;
    g.to = y, g.wt = w, g.type = 't', g.edgeCode = edgeCode++;
    edges[1].push_back(g);
  }
  vector<long long> dis(n + 1, 100000000000000000);
  vector<bool> visited(n + 1, false);
  vector<pair<long long, long long> > par(n + 1, {-1, -1});
  dis[1] = 0;
  dijkstra(n, edges, dis, visited, par);
  long long ans = 0;
  for (long long i = 0; i < k; ++i) {
    long long dest = trainPaths[i].first, edgeCode = trainPaths[i].second;
    if (par[dest].first == 1 && par[dest].second == edgeCode) {
      continue;
    }
    ++ans;
  }
  cout << ans << endl;
  return 0;
}
