#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > g[100005];
priority_queue<pair<long long, pair<int, int> > > q;
int n, m, k;
long long d[100005];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  while (m--) {
    int x, y, c;
    scanf("%d%d%d", &x, &y, &c);
    x--;
    y--;
    g[x].push_back(make_pair(y, c));
    g[y].push_back(make_pair(x, c));
  }
  memset(d, -1, sizeof(d));
  q.push(make_pair(0, make_pair(0, 0)));
  int r = k;
  while (k--) {
    int x, c;
    scanf("%d%d", &x, &c);
    x--;
    q.push(make_pair(-c, make_pair(-k - 2, x)));
  }
  while (!q.empty()) {
    int x = q.top().second.second, w = q.top().second.first;
    long long c = q.top().first;
    q.pop();
    if (d[x] >= 0) continue;
    if (w < 0) r--;
    d[x] = -c;
    for (int i = 0, to = g[x].size(); i < to; ++i) {
      int y = g[x][i].first, c1 = g[x][i].second;
      if (d[y] < 0) {
        q.push(make_pair(c - c1, make_pair(0, y)));
      }
    }
  }
  printf("%d\n", r);
  return 0;
}
