#include <bits/stdc++.h>
using namespace std;
const long long inf = 1ll << 60;
const int maxn = 100005;
int n, m, tot;
int head[maxn];
long long dis[maxn];
bool vis[maxn], flag[maxn], use[maxn];
struct edge {
  int next, to, val;
} ji[maxn * 10];
void add(int x, int y, int w) {
  ji[tot].next = head[x];
  ji[tot].to = y;
  ji[tot].val = w;
  head[x] = tot++;
}
struct node {
  int to;
  long long len;
  node(int x, long long y) : to(x), len(y) {}
  bool operator<(const node& a) const { return len > a.len; }
};
void dij() {
  priority_queue<node> q;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++)
    if (dis[i] != inf) {
      q.push(node(i, dis[i]));
    }
  while (!q.empty()) {
    node now = q.top();
    q.pop();
    if (vis[now.to]) continue;
    vis[now.to] = 1;
    for (int k = head[now.to]; k != -1; k = ji[k].next) {
      int toit = ji[k].to;
      if (dis[toit] >= dis[now.to] + ji[k].val) flag[toit] = 1;
      if (dis[toit] > dis[now.to] + ji[k].val) {
        dis[toit] = dis[now.to] + ji[k].val;
        q.push(node(toit, dis[toit]));
      }
    }
  }
}
int ts[maxn], tl[maxn], k;
int main() {
  int a, b, c;
  memset(head, -1, sizeof(head));
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 2; i <= n; i++) dis[i] = inf;
  for (int i = 0; i < m; i++) {
    scanf("%d%d%d", &a, &b, &c);
    add(a, b, c);
    add(b, a, c);
  }
  for (int i = 0; i < k; i++) {
    scanf("%d%d", ts + i, tl + i);
    dis[ts[i]] = min(dis[ts[i]], (long long)tl[i]);
  }
  dij();
  int res = 0;
  for (int i = 0; i < k; i++) {
    if (dis[ts[i]] < tl[i] || flag[ts[i]])
      res++;
    else if (dis[ts[i]] == tl[i]) {
      if (use[ts[i]])
        res++;
      else
        use[ts[i]] = 1;
    }
  }
  printf("%d\n", res);
}
