#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
bool mod(long double a, long double b) { return a / b - floor(a / b); }
const long long N = 1e5 + 5;
vector<pair<long long, pair<long long, long long>>> graph[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j, first, n, m, k;
  cin >> n >> m >> k;
  for (i = 0; i < m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    graph[a].push_back({b, {c, 0}});
    graph[b].push_back({a, {c, 0}});
  }
  for (i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    graph[1].push_back({a, {b, 1}});
  }
  priority_queue<pair<long long, pair<long long, long long>>,
                 vector<pair<long long, pair<long long, long long>>>,
                 greater<pair<long long, pair<long long, long long>>>>
      q;
  vector<long long> vis(n + 1), dis(n + 1, 1000000000000007);
  q.push({0, {1, 0}});
  long long cnt = 0;
  while (!q.empty()) {
    pair<long long, pair<long long, long long>> p = q.top();
    q.pop();
    if (vis[p.second.first]) {
      if (p.second.second) {
        cnt++;
      }
      continue;
    }
    vis[p.second.first] = 1;
    long long a = p.second.first, w = p.first;
    for (pair<long long, pair<long long, long long>> aa : graph[a]) {
      q.push({w + aa.second.first, {aa.first, aa.second.second}});
      dis[aa.first] = min(dis[aa.first], w + aa.second.first);
    }
  }
  cout << cnt << '\n';
  return 0;
}
