#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, k, ans = 0;
vector<pair<int, int> > e[N];
int vis[N], dis[N], flag[N];
priority_queue<pair<int, int>, vector<pair<int, int> >,
               greater<pair<int, int> > >
    q;
void dij(int s) {
  while (!q.empty()) {
    pair<int, int> u = q.top();
    q.pop();
    if (vis[u.second]) continue;
    vis[u.second] = 1;
    for (auto v : e[u.second]) {
      if (dis[v.second] >= dis[u.second] + v.first) {
        if (flag[v.second] == 0 && dis[v.second] != 0x3f3f3f3f) ++ans;
        flag[v.second] = 1;
        dis[v.second] = dis[u.second] + v.first;
        q.push({dis[v.second], v.second});
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  while (m--) {
    int u, v, w;
    scanf("%d%d%d", &u, &v, &w);
    e[u].push_back({w, v});
    e[v].push_back({w, u});
  }
  memset(vis, 0, sizeof(vis));
  memset(dis, 0x3f, sizeof(dis));
  for (int i = 1; i <= k; ++i) {
    int v, w;
    scanf("%d%d", &v, &w);
    if (dis[v] != 0x3f3f3f3f) ++ans;
    dis[v] = min(dis[v], w);
  }
  dis[1] = 0;
  for (int i = 1; i <= n; ++i)
    if (dis[i] != 0x3f3f3f3f) q.push({dis[i], i});
  dij(1);
  printf("%d\n", ans);
  return 0;
}
