#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T t) {
  cout << t << endl;
}
template <typename T, typename... Args>
void print(T t, Args... args) {
  cout << t << " ";
  print(args...);
}
long long n, m, k;
vector<pair<long long, long long>> v[200005];
map<long long, long long> mp;
long long minans[200005];
long long ctr = 0;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    v[a].push_back({b, c});
    v[b].push_back({a, c});
  }
  for (long long i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    if (mp.find(a) != mp.end()) {
      ctr++;
      mp[a] = min(mp[a], b);
    } else
      mp[a] = b;
  }
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      pq;
  for (long long i = 1; i <= n; i++) minans[i] = 1e18;
  pq.push({0, 1});
  for (auto i : mp) pq.push({i.second, i.first});
  while (pq.size()) {
    auto i = pq.top();
    pq.pop();
    if (minans[i.second] <= i.first) continue;
    minans[i.second] = i.first;
    for (auto j : v[i.second])
      if (minans[j.first] > i.first + j.second)
        pq.push({i.first + j.second, j.first});
  }
  for (auto i : mp) {
    long long fl = 1;
    if (minans[i.first] < i.second) {
      ctr++;
      continue;
    }
    for (auto j : v[i.first])
      if (minans[i.first] - minans[j.first] == j.second) fl = 0;
    if (!fl) ctr++;
  }
  print(ctr);
}
