#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, int>>> adj[100010],
    new_adj_of_all_shortest_paths[100010];
int xMove[] = {1, 0, -1, 0, 1, 1, -1, -1};
int yMove[] = {0, 1, 0, -1, 1, -1, 1, -1};
void clr() {
  for (int i = 0; i < 100010; i++) adj[i].clear();
}
void add_edge(int u, int v, int c, int deletable) {
  adj[u].push_back(pair<int, pair<int, int>>(deletable, pair<int, int>(v, c)));
  adj[v].push_back(pair<int, pair<int, int>>(deletable, pair<int, int>(u, c)));
}
long long dist[100010], p[100010];
void dijkstra(int s, int n) {
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  pq.push(pair<long long, long long>(0, s));
  for (int i = 1; i <= n; i++) dist[i] = 1e15;
  dist[s] = 0, p[s] = -1;
  while (!pq.empty()) {
    long long u = pq.top().second, c = pq.top().first;
    pq.pop();
    if (c > dist[u]) continue;
    for (pair<long long, pair<long long, long long>> edge : adj[u]) {
      long long v = edge.second.first, cost = edge.second.second;
      if (dist[u] + cost < dist[v]) {
        dist[v] = dist[u] + cost;
        p[v] = u;
        pq.push(pair<int, int>(dist[v], v));
      }
    }
  }
}
vector<pair<int, pair<int, int>>> erased_edges, normal_edges;
void print_path(int d) {
  if (p[d] == -1) {
    printf("%d", 1);
    return;
  }
  print_path(p[d]);
  printf(" %d", d);
}
int deletable_edge_used_in_shortest_paths = 0;
int in_degree[100010];
void build_new_directed_graph_for_all_possible_shortest_path(int n) {
  for (int i = 1; i <= n; i++) {
    for (pair<int, pair<int, int>> edge : adj[i]) {
      int deletable = edge.first, u = i, v = edge.second.first,
          cost = edge.second.second;
      if (dist[u] + cost == dist[v]) {
        new_adj_of_all_shortest_paths[u].push_back(
            pair<int, pair<int, int>>(deletable, pair<int, int>(v, cost)));
        in_degree[v]++;
        if (deletable) deletable_edge_used_in_shortest_paths++;
      }
    }
  }
  for (pair<int, pair<int, int>> edge : new_adj_of_all_shortest_paths[1]) {
    long long deletable = edge.first, v = edge.second.first,
              cost = edge.second.second;
    if (in_degree[v] > 1 && deletable) {
      deletable_edge_used_in_shortest_paths--;
      in_degree[v]--;
    }
  }
}
int main() {
  int TC = 1;
  int n, m, u, v, q, p, c, k, a, b, s, t, l;
  cin >> n >> m >> k;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %d", &u, &v, &c);
    add_edge(u, v, c, 0);
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d %d", &v, &c);
    add_edge(1, v, c, 1);
  }
  dijkstra(1, n);
  build_new_directed_graph_for_all_possible_shortest_path(n);
  printf("%d\n", k - deletable_edge_used_in_shortest_paths);
  clr();
  return 0;
}
