#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long n, m, k;
long long dist[N];
pair<long long, long long> par[N];
vector<pair<long long, pair<long long, long long> > > adj[N];
void djikstra(long long start) {
  for (long long a = 1; a <= n; a++) dist[a] = 1e18;
  dist[start] = 0;
  priority_queue<pair<long long, long long> > pq;
  pq.push({0, start});
  while (pq.empty() == false) {
    pair<long long, long long> tmp = pq.top();
    pq.pop();
    if (-1 * tmp.first > dist[tmp.second]) continue;
    long long u = tmp.second;
    for (long long a = 0; a < adj[u].size(); a++) {
      long long v = adj[u][a].first;
      long long w = adj[u][a].second.first;
      if ((dist[u] + w < dist[v]) ||
          (dist[u] + w == dist[v] && adj[u][a].second.second == 0 &&
           par[v].second == 1)) {
        par[v].first = u;
        par[v].second = adj[u][a].second.second;
        dist[v] = dist[u] + w;
        pq.push({-1 * dist[v], v});
      }
    }
  }
}
int main() {
  scanf("%lld%lld%lld", &n, &m, &k);
  for (long long a = 1; a <= m; a++) {
    long long u, v, w;
    scanf("%lld%lld%lld", &u, &v, &w);
    adj[u].push_back({v, {w, 0}});
    adj[v].push_back({u, {w, 0}});
  }
  for (long long a = 1; a <= k; a++) {
    long long second, x;
    scanf("%lld%lld", &second, &x);
    adj[1].push_back({second, {x, 1}});
    adj[second].push_back({1, {x, 1}});
  }
  djikstra(1);
  long long ans = 0;
  for (long long a = 1; a <= n; a++) ans += par[a].second;
  printf("%lld\n", k - ans);
  return 0;
}
