#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
long long inf = 9999999999999999;
map<long long, long long> train, graph[N];
vector<long long> parent(N, -1), dis(N, inf), vis(N, 0);
void shortest_path(long long n) {
  dis[1] = 0;
  parent[1] = -1;
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      P;
  P.push({0, 1});
  long long vv = 0;
  while (!P.empty()) {
    if (vv == n) break;
    auto x = P.top();
    P.pop();
    if (vis[x.second] == 1) continue;
    vis[x.second] = 1;
    vv++;
    for (auto z : graph[x.second]) {
      if (vis[z.first]) continue;
      if (dis[z.first] >= dis[x.second] + z.second) {
        dis[z.first] = dis[x.second] + z.second;
        P.push({dis[z.first], z.first});
        parent[z.first] = x.second;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long u, v, w, n, m, k, i, j;
  cin >> n >> m >> k;
  for (i = 0; i < m; i++) {
    cin >> u >> v >> w;
    if (graph[u].find(v) != graph[u].end()) {
      graph[u][v] = min(graph[u][v], w);
      graph[v][u] = min(graph[v][u], w);
    } else {
      graph[u][v] = w;
      graph[v][u] = w;
    }
  }
  for (i = 0; i < k; i++) {
    cin >> v >> w;
    if (graph[1].find(v) != graph[1].end()) {
      if (graph[1][v] > w) {
        graph[1][v] = graph[v][1] = w;
        train[v] = 1;
      }
    } else {
      graph[1][v] = graph[v][1] = w;
      train[v] = 1;
    }
  }
  shortest_path(n);
  set<long long> g;
  vector<short> jt(N, 0);
  for (i = 2; i <= n; i++) {
    long long z = i;
    while (z != -1) {
      if (jt[z] == 1) break;
      if (parent[z] == 1 && train.find(z) != train.end()) g.insert(z);
      jt[z] = 1;
      z = parent[z];
    }
  }
  cout << k - g.size();
}
