#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<pair<long long, int> > g[N];
long long dist[N];
int n, m, k;
int dij() {
  int ans = 0;
  priority_queue<pair<long long, int>, vector<pair<long long, int> >,
                 greater<pair<long long, int> > >
      pq;
  for (int i = 0; i < k; ++i) {
    int s, y;
    scanf("%d %d", &s, &y);
    pq.push(pair<long long, int>(y, -(s - 1)));
  }
  pq.push(pair<long long, int>(0, 0));
  dist[0] = 0;
  while (!pq.empty()) {
    pair<long long, int> top = pq.top();
    pq.pop();
    long long d = top.first;
    int u = top.second;
    if (u < 0) {
      u *= -1;
      if (dist[u] <= d) {
        ans++;
        continue;
      } else
        dist[u] = d;
    }
    if (d > dist[u]) continue;
    for (vector<pair<long long, int> >::iterator v = g[u].begin();
         v != g[u].end(); ++v) {
      if (dist[v->second] > dist[u] + v->first) {
        dist[v->second] = dist[u] + v->first;
        pq.push(pair<long long, int>(dist[v->second], v->second));
      }
    }
  }
  return ans;
}
int main(void) {
  scanf("%d %d %d", &n, &m, &k);
  fill(dist, dist + n + 1, 1e15);
  for (int i = 0; i < m; ++i) {
    int a, b;
    long long c;
    scanf("%d %d %lld", &a, &b, &c);
    --a, --b;
    g[a].push_back(pair<long long, int>(c, b));
    g[b].push_back(pair<long long, int>(c, a));
  }
  printf("%d\n", dij());
}
