#include <bits/stdc++.h>
const double eps = (1e-5);
using namespace std;
int dcmp(double a, double b) {
  return fabs(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(int num, int idx) { return ((num >> idx) & 1) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
long long cnt = 0, vis[100009];
long long dist[100009];
long long inf = (1ll << 62);
typedef struct Node {
  long long no, f;
  long long w;
  Node(long long no, long long w, long long f) : no(no), w(w), f(f) {}
  bool operator<(const Node &e) const {
    if (w == e.w)
      return f > e.f;
    else
      return w > e.w;
  }
} N;
vector<vector<N> > v(100009);
void dijk() {
  for (int i = 0; i < 100009; i++) dist[i] = inf;
  priority_queue<N> pq;
  pq.push(N(1, 0, 0));
  dist[1] = 0;
  while (!pq.empty()) {
    N cur = pq.top();
    pq.pop();
    if (vis[cur.no]) continue;
    if (cur.f == 1) cnt++;
    vis[cur.no] = 1;
    long long add = cur.w;
    for (int i = 0; i < ((int)(v[cur.no]).size()); i++) {
      N nw = v[cur.no][i];
      if (dist[nw.no] >= add + nw.w) {
        dist[nw.no] = add + nw.w;
        pq.push(N(nw.no, add + nw.w, nw.f));
      }
    }
  }
}
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  long long x, y, w;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> w;
    v[x].push_back(N(y, w, 0));
    v[y].push_back(N(x, w, 0));
  }
  for (int i = 0; i < k; i++) {
    cin >> y >> w;
    v[1].push_back(N(y, w, 1));
    v[y].push_back(N(1, w, 1));
  }
  dijk();
  cout << k - cnt << endl;
}
