#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MAXN = (int)5e5 + 5;
vector<pair<long long, long long>> adj[MAXN];
vector<pair<long long, long long>> adj2;
map<pair<long long, long long>, bool> mp2;
long long n;
void dijkstra(long long s, vector<long long>& d, vector<long long>& p) {
  d.assign(n, INF);
  p.assign(n, -1);
  d[s] = 0;
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      q;
  q.push({0, s});
  while (!q.empty()) {
    long long v = q.top().second;
    long long d_v = q.top().first;
    q.pop();
    if (d_v != d[v]) continue;
    for (auto edge : adj[v]) {
      long long to = edge.first;
      long long len = edge.second;
      if (d[v] + len < d[to]) {
        d[to] = d[v] + len;
        p[to] = v;
        q.push({d[to], to});
      }
    }
  }
}
void solve() {
  long long m, k;
  cin >> n >> m >> k;
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < m; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    adj[a].push_back(make_pair(b, c));
    adj[b].push_back(make_pair(a, c));
    if (a == 0 || b == 0) {
      mp[{max(a, b), c}] = 1;
    }
  }
  for (long long i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    adj[0].push_back(make_pair(a, b));
    adj[a].push_back(make_pair(0, b));
    adj2.push_back({a, b});
  }
  vector<long long> d(MAXN), p(MAXN);
  dijkstra(0, d, p);
  long long ans = 0;
  for (long long i = 0; i < k; i++) {
    if (d[adj2[i].first] < adj2[i].second || mp[adj2[i]]) {
      ans++;
    } else if (mp2[adj2[i]] == false) {
      int cnt = 0;
      for (auto q : adj[adj2[i].first]) {
        int u = q.first;
        if (u == 0 && q.second == adj2[i].second) {
          cnt++;
          continue;
        }
        if (d[u] + q.second == adj2[i].second) {
          ans++;
          break;
        }
      }
      if (cnt) {
        ans += cnt - 1;
        mp2[adj2[i]] = true;
      }
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t = 1;
  while (t--) {
    solve();
  }
}
