#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<pair<int, long long int> > G[N], H[N];
long long int dis1[N], dis2[N], y;
int mark[N];
int n, m, x, z, k, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  while (m--) {
    cin >> x >> y >> z;
    G[x].push_back(make_pair(y, z));
    G[y].push_back(make_pair(x, z));
  }
  for (int i = 0; i < N; i++) {
    dis1[i] = 999876543223456777;
  }
  while (k--) {
    cin >> x >> y;
    if (!mark[x]) {
      mark[x] = 1;
      dis1[x] = y;
    } else {
      ++ans;
      dis1[x] = min(dis1[x], y);
    }
  }
  set<pair<long long int, int> > bfs;
  for (int i = 2; i <= n; i++) {
    if (mark[i]) bfs.insert(make_pair(dis1[i], i));
  }
  dis1[1] = 0;
  bfs.insert(make_pair(0, 1));
  while (!bfs.empty()) {
    auto cur = *(bfs.begin());
    int curVertex = cur.second;
    long long int curDist = cur.first;
    bfs.erase(cur);
    if (curDist > dis1[curVertex]) continue;
    for (auto to : G[curVertex]) {
      int toVertex = to.first;
      long long int toDist = to.second;
      if (dis1[toVertex] >= (long long int)curDist + toDist) {
        if (mark[toVertex]) {
          ans += 1;
          mark[toVertex] = 0;
        }
        bfs.erase(make_pair(toDist, toVertex));
        dis1[toVertex] = curDist + toDist;
        bfs.insert(make_pair(dis1[toVertex], toVertex));
      }
    }
  }
  cout << ans;
}
