#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
const int maxm = 4e5 + 10;
using namespace std;
struct Edge {
  int next, v;
  long long w;
} edge[maxm << 1];
int head[maxn], tot;
int vis[maxn], flg[maxn];
long long d[maxn], f[maxn];
int n, m, k, cnt;
void init() {
  for (int i = 1; i <= n; i++) {
    head[i] = -1;
    vis[i] = 0;
    flg[i] = 0;
    d[i] = INF;
    f[i] = 0;
  }
  tot = 0;
  cnt = 0;
}
void add(int u, int v, long long w) {
  edge[tot].v = v;
  edge[tot].w = w;
  edge[tot].next = head[u];
  head[u] = tot++;
}
struct Node {
  int v;
  long long w;
} node[maxn];
void spfa() {
  priority_queue<int> q;
  q.push(1);
  d[1] = 0;
  vis[1] = 1;
  while (!q.empty()) {
    int u = q.top();
    q.pop();
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].v;
      if (d[u] + edge[i].w < d[v]) {
        d[v] = edge[i].w + d[u];
        flg[v] = 1;
        if (!vis[v]) {
          vis[v] = 1;
          q.push(v);
        }
      } else if (d[u] + edge[i].w == d[v] && flg[v]) {
        flg[v]++;
      }
    }
    vis[u] = 0;
  }
}
int main() {
  while (scanf("%d %d %d", &n, &m, &k) != EOF) {
    init();
    int u, v;
    long long w;
    for (int i = 1; i <= m; i++) {
      scanf("%d %d %I64d", &u, &v, &w);
      add(u, v, w);
      add(v, u, w);
    }
    int len = 0;
    for (int i = 1; i <= k; i++) {
      scanf("%d %I64d", &v, &w);
      if (f[v] <= w && f[v]) {
        cnt++;
        continue;
      }
      add(1, v, w);
      node[len].v = v;
      node[len].w = w;
      len++;
      f[v] = w;
    }
    spfa();
    for (int i = 0; i < len; i++) {
      int v = node[i].v;
      long long w = node[i].w;
      if (d[v] < w) {
        cnt++;
      } else if (d[v] == w && flg[v] > 1) {
        flg[v]--;
        cnt++;
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
