#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u, v, nxt;
  long long w;
} edges[888888];
int nedge;
int head[100008];
long long dis[100008];
int n, m, k;
bool vis[100008];
bool flag[100008];
long long train[100008];
void add_edge(int u, int v, long long w) {
  edges[nedge].u = u;
  edges[nedge].v = v;
  edges[nedge].w = w;
  edges[nedge].nxt = head[u];
  head[u] = nedge++;
}
queue<int> que;
int cnt;
void spfa() {
  memset(vis, 0, sizeof vis);
  dis[1] = 0;
  vis[1] = 1;
  que.push(1);
  int u, v;
  while (!que.empty()) {
    u = que.front();
    cnt++;
    if (cnt > 1000000) return;
    que.pop();
    vis[u] = 0;
    for (int i = head[u]; i != -1; i = edges[i].nxt) {
      v = edges[i].v;
      if (dis[u] + edges[i].w < dis[v]) {
        dis[v] = dis[u] + edges[i].w;
        if (!vis[v]) {
          vis[v] = 1;
          que.push(v);
        }
      } else if (dis[u] + edges[i].w == dis[v]) {
        if (train[v] == dis[v]) {
          flag[v] = 1;
        }
      }
    }
  }
}
int main() {
  memset(head, -1, sizeof head);
  memset(train, -1, sizeof train);
  memset(flag, 0, sizeof flag);
  nedge = 0;
  long long ans = 0;
  int u, v;
  long long w;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d %I64d", &u, &v, &w);
    add_edge(u, v, w);
    add_edge(v, u, w);
  }
  for (int i = 0; i <= n; i++) {
    dis[i] = 1000000000000000LL;
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d %I64d", &v, &w);
    if (w < dis[v]) {
      if (train[v] != -1) {
        ans++;
        train[v] = min(train[v], w * 1LL);
      } else
        train[v] = w;
    } else
      ans++;
  }
  spfa();
  for (int i = 1; i <= n; i++) {
    if (train[i] != -1) {
      add_edge(1, i, train[i]);
      add_edge(i, 1, train[i]);
    }
  }
  spfa();
  for (int i = 1; i <= n; i++) {
    if (dis[i] < train[i] && train[i] != -1) {
      ans++;
    } else if (train[i] != -1 && flag[i] && dis[i] == train[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
