#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const long long INF = 1e17;
const int maxn = 1e5 + 10;
struct Edge {
  int from, to, dist;
};
struct HeapNode {
  long long d, u;
  bool operator<(const HeapNode& rhs) const { return d > rhs.d; }
};
struct Dijkstra {
  int n, m;
  vector<Edge> edges;
  vector<int> G[maxn];
  bool done[maxn];
  long long d[maxn];
  int p[maxn];
  void init(int n) {
    this->n = n;
    for (int i = 0; i < n; i++) G[i].clear();
    edges.clear();
  }
  void AddEdge(int from, int to, int dist) {
    edges.push_back((Edge){from, to, dist});
    m = edges.size();
    G[from].push_back(m - 1);
  }
  void dijkstra(int s) {
    priority_queue<HeapNode> Q;
    for (int i = 0; i < n; i++) d[i] = INF;
    d[s] = 0;
    memset(done, 0, sizeof(done));
    Q.push((HeapNode){0, s});
    while (!Q.empty()) {
      HeapNode x = Q.top();
      Q.pop();
      int u = x.u;
      if (done[u]) continue;
      done[u] = true;
      for (int i = 0; i < G[u].size(); i++) {
        Edge& e = edges[G[u][i]];
        if (d[e.to] > d[u] + e.dist) {
          d[e.to] = d[u] + e.dist;
          p[e.to] = G[u][i];
          Q.push((HeapNode){d[e.to], e.to});
        }
      }
    }
  }
  void GetShortestPaths(int s, int* dist, vector<int>* paths) {
    dijkstra(s);
    for (int i = 0; i < n; i++) {
      dist[i] = d[i];
      paths[i].clear();
      int t = i;
      paths[i].push_back(t);
      while (t != s) {
        paths[i].push_back(edges[p[t]].from);
        t = edges[p[t]].from;
      }
      reverse(paths[i].begin(), paths[i].end());
    }
  }
  vector<int> GetShortestPaths(int s, int t) {
    vector<int> path;
    path.push_back(t);
    while (t != s) {
      path.push_back(edges[p[t]].from);
      t = edges[p[t]].from;
    }
    reverse(path.begin(), path.end());
    return path;
  }
};
Dijkstra so;
struct train {
  int des, len;
} tra[maxn];
int n, m, k;
int u, v, x;
int s, y;
vector<int> in[maxn];
int main() {
  cin >> n >> m >> k;
  so.init(n + 1);
  for (int t = (0); t < (m); ++t) {
    scanf("%d%d%d", &u, &v, &x);
    so.AddEdge(u, v, x), so.AddEdge(v, u, x);
  }
  for (int t = (0); t < (k); ++t) {
    scanf("%d%d", &tra[t].des, &tra[t].len);
    so.AddEdge(1, tra[t].des, tra[t].len);
  }
  so.dijkstra(1);
  for (int t = (0); t < (so.edges.size()); ++t) {
    Edge& cur = so.edges[t];
    int &u = cur.from, &v = cur.to;
    if (cur.dist == abs(so.d[u] - so.d[v])) {
      if (so.d[u] > so.d[v]) {
        in[u].push_back(t);
      } else {
        in[v].push_back(t);
      }
    }
  }
  int cnt = 0;
  for (int t = (0); t < (k); ++t) {
    if (tra[t].len > so.d[tra[t].des])
      ++cnt;
    else {
      int des = tra[t].des;
      if (in[des].size() > 1) {
        ++cnt;
        in[des].pop_back();
      }
    }
  }
  cout << cnt;
}
