#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
struct Node {
  int to;
  long long dis;
  int type;
  Node(int a = 0, long long b = 0, int c = 0) {
    to = a;
    dis = b;
    type = c;
  }
  friend bool operator<(Node a, Node b) {
    if (a.dis != b.dis) return a.dis > b.dis;
    return a.type > b.type;
  }
};
int n, m, k;
int vis[100005], p[100005];
long long dis[100005];
vector<Node> v[100005];
void djs(int x) {
  memset(vis, 0, sizeof(vis));
  memset(p, 0, sizeof(p));
  for (int i = 0; i <= n; i++) dis[i] = INF;
  priority_queue<Node> q;
  q.push(Node(x, 0, 0));
  dis[x] = 0;
  Node u, w;
  while (!q.empty()) {
    u = q.top();
    q.pop();
    if (u.dis != dis[u.to] || vis[u.to]) continue;
    vis[u.to] = 1;
    for (int i = 0; i < v[u.to].size(); i++) {
      w = v[u.to][i];
      if (!vis[w.to]) {
        if (u.dis + w.dis < dis[w.to]) {
          dis[w.to] = u.dis + w.dis;
          q.push(Node(w.to, dis[w.to], 0));
          p[w.to] = w.type;
        } else if (u.dis + w.dis == dis[w.to] && w.type == 0) {
          p[w.to] = w.type;
        }
      }
    }
  }
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &k)) {
    for (int i = 0; i <= n; i++) {
      while (!v[i].empty()) v[i].clear();
    }
    int a, b;
    long long c;
    for (int i = 0; i < m; i++) {
      scanf("%d%d%lld", &a, &b, &c);
      v[a].push_back(Node(b, c, 0));
      v[b].push_back(Node(a, c, 0));
    }
    for (int i = 0; i < k; i++) {
      scanf("%d%lld", &b, &c);
      v[1].push_back(Node(b, c, 1));
      v[b].push_back(Node(1, c, 1));
    }
    djs(1);
    for (int i = 2; i <= n; i++) {
      k -= p[i];
    }
    printf("%d\n", k);
  }
  return 0;
}
