#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int maxm = 4e5 + 7;
const int inf = 0x3f3f3f3f;
struct Node {
  int to;
  int val;
  int next;
} edge[maxm << 1];
struct LDJ {
  int to;
  int val;
} num[maxm];
int cnt;
int head[maxn];
int train[maxn];
int dis[maxn];
bool vis[maxn];
int road_cnt[maxn];
void init() {
  memset(head, -1, sizeof(head));
  memset(road_cnt, 0, sizeof(road_cnt));
  cnt = 0;
  return;
}
void add(int u, int v, int val) {
  edge[cnt].to = v;
  edge[cnt].val = val;
  edge[cnt].next = head[u];
  head[u] = cnt++;
  edge[cnt].to = u;
  edge[cnt].val = val;
  edge[cnt].next = head[v];
  head[v] = cnt++;
  return;
}
void spfa() {
  memset(dis, inf, sizeof(dis));
  memset(vis, false, sizeof(vis));
  dis[1] = 0;
  vis[1] = true;
  queue<int> que;
  que.push(1);
  while (!que.empty()) {
    int node = que.front();
    que.pop();
    vis[node] = false;
    for (int i = head[node]; ~i; i = edge[i].next) {
      int v = edge[i].to;
      if (dis[v] > dis[node] + edge[i].val) {
        dis[v] = dis[node] + edge[i].val;
        road_cnt[v] = 1;
        if (!vis[v]) {
          vis[v] = true;
          que.push(v);
        }
      } else if (dis[v] == dis[node] + edge[i].val) {
        road_cnt[v]++;
      }
    }
  }
  return;
}
void dijkstra() {
  memset(dis, inf, sizeof(dis));
  memset(vis, false, sizeof(vis));
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      que;
  dis[1] = 0;
  que.push(make_pair(dis[1], 1));
  while (!que.empty()) {
    pair<int, int> now = que.top();
    que.pop();
    int node = now.second;
    if (vis[node]) continue;
    vis[node] = true;
    for (int i = head[node]; ~i; i = edge[i].next) {
      int v = edge[i].to;
      if (!vis[v] && dis[v] > dis[node] + edge[i].val) {
        dis[v] = dis[node] + edge[i].val;
        road_cnt[v] = 1;
        que.push(make_pair(dis[v], v));
      } else if (dis[v] == dis[node] + edge[i].val) {
        road_cnt[v]++;
      }
    }
  }
  return;
}
int main() {
  int n, m, k;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    init();
    for (int i = 0; i < m; i++) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      add(u, v, w);
    }
    for (int i = 0; i < k; i++) {
      scanf("%d%d", &num[i].to, &num[i].val);
      add(1, num[i].to, num[i].val);
    }
    dijkstra();
    int ans = 0;
    for (int i = 0; i < k; i++) {
      if (dis[num[i].to] < num[i].val) {
        ans++;
      } else if (dis[num[i].to] == num[i].val) {
        if (road_cnt[num[i].to] > 1) {
          ans++;
          road_cnt[num[i].to]--;
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
