#include <bits/stdc++.h>
using namespace std;
const int block = 400;
const long long base = 31, base2 = 37;
const long long mod = 1e9 + 7, mod2 = 1e9 + 9;
int n, m, k, deg[100011];
vector<pair<long long, long long> > adj[100011], cap;
set<pair<long long, pair<long long, long long> > > new_graph;
long long dist[100011];
bool vis[100011];
void dijkstra() {
  for (int i = 1; i <= n; i++) dist[i] = 1e16;
  dist[1] = 0LL;
  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, 1));
  while (!pq.empty()) {
    long long u = pq.top().second;
    pq.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    for (auto P : adj[u]) {
      long long v = P.first, w = P.second;
      if (dist[u] + w < dist[v]) {
        dist[v] = dist[u] + w;
        pq.push(pair<long long, long long>(dist[v], v));
      }
    }
  }
}
void dfs(int u) {
  vis[u] = 1;
  for (auto P : adj[u]) {
    long long v = P.first, w = P.second;
    if (dist[u] + w == dist[v]) {
      new_graph.insert(pair<long long, pair<long long, long long> >(
          w, pair<long long, long long>(u, v)));
      deg[v]++;
      if (!vis[v]) dfs(v);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= m; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    adj[u].push_back(pair<long long, long long>(v, w));
    adj[v].push_back(pair<long long, long long>(u, w));
  }
  for (int i = 1; i <= k; i++) {
    long long u, w;
    cin >> u >> w;
    cap.push_back(pair<long long, long long>(u, w));
    adj[1].push_back(pair<long long, long long>(u, w));
    adj[u].push_back(pair<long long, long long>(1, w));
  }
  dijkstra();
  memset(vis, 0, sizeof(vis));
  dfs(1);
  int ans = 0;
  for (int i = 0; i < k; i++) {
    pair<long long, pair<long long, long long> > cur_edge =
        pair<long long, pair<long long, long long> >(
            cap[i].second, pair<long long, long long>(1, cap[i].first));
    if (new_graph.find(cur_edge) == new_graph.end()) {
      ans++;
    } else if (deg[cap[i].first] > 1) {
      ans++;
      deg[cap[i].first]--;
    }
  }
  cout << ans;
  return 0;
}
