#include <bits/stdc++.h>
using namespace std;
const int maxx = 3 * 1e5 + 20;
long long INF = 1e15 + 20;
long long d[maxx];
bool mark[maxx];
vector<pair<pair<long long, int>, bool> > adj[maxx];
set<pair<long long, int> > s;
void relax(int u, int v, int w, bool t) {
  if (d[u] + w < d[v]) {
    mark[v] = true;
    if (!t) mark[v] = false;
    s.erase({d[v], v});
    d[v] = d[u] + w;
    s.insert({d[v], v});
  } else if (d[u] + w == d[v] && !t)
    mark[v] = false;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, k, cnt = 0;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int v, u, w;
    cin >> v >> u >> w;
    adj[v].push_back(make_pair(make_pair(u, w), 0));
    adj[u].push_back(make_pair(make_pair(v, w), 0));
  }
  for (int i = 0; i < k; i++) {
    int s, y;
    cin >> s >> y;
    adj[1].push_back(make_pair(make_pair(s, y), 1));
    adj[s].push_back(make_pair(make_pair(1, y), 1));
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) d[i] = INF;
    s.insert({d[i], i});
  }
  for (int i = 1; i <= n; i++) {
    int u = s.begin()->second;
    s.erase(s.begin());
    for (int j = 0; j < adj[u].size(); j++) {
      int v = adj[u][j].first.first;
      int w = adj[u][j].first.second;
      bool t = adj[u][j].second;
      relax(u, v, w, t);
    }
  }
  for (int i = 1; i <= n; i++)
    if (mark[i]) cnt++;
  cout << k - cnt;
}
