#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long oo = 1e18;
const long long mod = 1e9 + 7;
const int INF = 1 << 30;
vector<pair<pair<int, long long>, int>> adj[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n, m, k;
  cin >> n >> m >> k;
  map<pair<int, int>, long long> edges;
  for (int i = 0; i < m; i++) {
    int u, v;
    long long w;
    cin >> u >> v >> w;
    edges[{u, v}] = w;
    adj[u].push_back({{v, w}, 0});
    adj[v].push_back({{u, w}, 0});
  }
  int ans = 0;
  for (int i = 0; i < k; i++) {
    int s;
    long long y;
    cin >> s >> y;
    adj[1].push_back({{s, y}, 1});
  }
  priority_queue<pair<pair<int, long long>, int>,
                 vector<pair<pair<int, long long>, int>>,
                 greater<pair<pair<int, long long>, int>>>
      q;
  long long dis[N];
  bool anagetHenaBeTrain[N];
  for (int i = 0; i < N; i++) dis[i] = INF;
  memset(anagetHenaBeTrain, false, sizeof(anagetHenaBeTrain));
  dis[1] = 0;
  q.push({{dis[1], 1}, 0});
  while (q.size()) {
    auto top = q.top();
    q.pop();
    long long cost = top.first.first;
    int node = top.first.second;
    int type = top.second;
    if (cost > dis[node]) continue;
    for (auto v : adj[node]) {
      if (v.first.second + cost < dis[v.first.first]) {
        dis[v.first.first] = v.first.second + cost;
        anagetHenaBeTrain[v.first.first] = v.second;
        q.push({{dis[v.first.first], v.first.first}, v.second});
      } else if (v.first.second + cost == dis[v.first.first]) {
        if (anagetHenaBeTrain[v.first.first] == 1 && v.second == 0) {
          anagetHenaBeTrain[v.first.first] = 0;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    if (anagetHenaBeTrain[i] == 1) ans++;
  cout << k - ans << endl;
  return 0;
}
