#include <bits/stdc++.h>
using namespace std;
vector<long long> usedTrains;
vector<vector<pair<long long, long long>>> gNoTrain;
vector<vector<pair<long long, long long>>> gYesTrain;
vector<long long> disNoTrain;
vector<long long> disYesTrain;
unordered_set<long long> tracks;
void no_train_dijkstra(int s) {
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      Q;
  Q.push(make_pair(0, s));
  disNoTrain[s] = 0;
  while (!Q.empty()) {
    pair<long long, long long> p = Q.top();
    Q.pop();
    int currV = (int)p.second;
    if (disNoTrain[currV] != p.first) continue;
    for (pair<long long, long long>& edge : gNoTrain[currV]) {
      int u = (int)edge.first;
      long long w = edge.second;
      if (disNoTrain[currV] + w < disNoTrain[u]) {
        disNoTrain[u] = disNoTrain[currV] + w;
        Q.push(make_pair(disNoTrain[u], u));
      }
    }
  }
}
void yes_train_dijkstra(int s) {
  priority_queue<pair<long long, long long>, vector<pair<long long, long long>>,
                 greater<pair<long long, long long>>>
      Q;
  Q.push(make_pair(0, s));
  disYesTrain[s] = 0;
  while (!Q.empty()) {
    pair<long long, long long> p = Q.top();
    Q.pop();
    int currV = (int)p.second;
    if (disYesTrain[currV] != p.first) continue;
    for (pair<long long, long long>& edge : gYesTrain[currV]) {
      int u = (int)edge.first;
      long long w = edge.second;
      if (currV != 0 && disYesTrain[currV] + w == disYesTrain[u]) {
        tracks.erase(u);
      }
      if (disYesTrain[currV] + w < disYesTrain[u]) {
        if (currV != 0) tracks.erase(u);
        disYesTrain[u] = disYesTrain[currV] + w;
        Q.push(make_pair((long long)disYesTrain[u], u));
      }
    }
  }
}
int n, m, k;
int main() {
  cin >> n >> m >> k;
  usedTrains = vector<long long>(k, 0);
  gNoTrain = vector<vector<pair<long long, long long>>>(
      n, vector<pair<long long, long long>>());
  gYesTrain = vector<vector<pair<long long, long long>>>(
      n, vector<pair<long long, long long>>());
  disNoTrain = vector<long long>(n, 100000000000l);
  disYesTrain = vector<long long>(n, 100000000000l);
  for (int i = 0; i < m; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    gNoTrain[u - 1].push_back({(long long)v - 1, (long long)w});
    gNoTrain[v - 1].push_back({(long long)u - 1, (long long)w});
    gYesTrain[u - 1].push_back({(long long)v - 1, (long long)w});
    gYesTrain[v - 1].push_back({(long long)u - 1, (long long)w});
  }
  no_train_dijkstra(0);
  for (int i = 0; i < k; i++) {
    int v, w;
    cin >> v >> w;
    gYesTrain[0].push_back({(long long)v - 1, (long long)w});
    gYesTrain[v - 1].push_back({0, (long long)w});
    if (w < disNoTrain[v - 1]) tracks.insert(v - 1);
  }
  no_train_dijkstra(0);
  yes_train_dijkstra(0);
  cout << (k - (long long)tracks.size()) << endl;
  return 0;
}
