#include <bits/stdc++.h>
using namespace std;
vector<int> road_wt[2 * 100000 + 5];
vector<int> rail_wt[2 * 100000 + 5];
vector<int> road[2 * 100000 + 5];
vector<int> rail[2 * 100000 + 5];
int visited[2 * 100000 + 5];
struct r {
  int city;
  signed long long int cost;
  int type;
  r() {}
  r(int c, signed long long int co, int t) {
    city = c;
    cost = co;
    type = t;
  }
};
signed long long int cost[100000 + 5];
bool way(r a, r b) { return a.cost > b.cost; }
struct OrderBy {
  bool operator()(struct r a, struct r b) {
    return a.cost > b.cost or a.cost == b.cost and a.type < b.type;
  }
};
priority_queue<struct r, std::vector<struct r>, OrderBy> q;
int main() {
  int n, k, m, a, b, s;
  signed long long int w, y;
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    cin >> a >> b >> w;
    road[a].push_back(b);
    road[b].push_back(a);
    road_wt[a].push_back(w);
    road_wt[b].push_back(w);
  }
  for (int i = 1; i <= k; ++i) {
    cin >> s >> y;
    rail[1].push_back(s);
    rail_wt[1].push_back(y);
  }
  q.push(r(1, 0, 0));
  int ans = 0;
  while (!q.empty()) {
    r temp = q.top();
    int v = temp.city;
    q.pop();
    if (visited[v]) continue;
    visited[v] = 1;
    cost[v] = temp.cost;
    if (temp.type == 1) ++ans;
    for (int i = 0; i < road[v].size(); ++i) {
      int u = road[v][i];
      if (visited[u]) continue;
      q.push(r(u, temp.cost + road_wt[v][i], 2));
    }
    for (int i = 0; i < rail[v].size(); ++i) {
      int u = rail[v][i];
      if (visited[u]) continue;
      q.push(r(u, temp.cost + rail_wt[v][i], 1));
    }
  }
  cout << k - ans;
}
