#include <bits/stdc++.h>
using namespace std;
const int M = 100001;
struct edge {
  int x;
  long long cst;
  bool f;
  edge(int a, long long b, bool c) {
    x = a;
    cst = b;
    f = c;
  }
  bool operator<(const edge &a) const {
    if (cst == a.cst) return f > a.f;
    return cst > a.cst;
  }
};
int n, m, x, y, z, k, ans;
long long cost[M];
bool vis[M];
vector<edge> v[M];
priority_queue<edge> q;
void dijkstra() {
  q.push(edge(1, 0, 0));
  for (int i = 1; i <= n; i++) cost[i] = 1e18;
  cost[1] = 0;
  while (!q.empty()) {
    int curnode = q.top().x;
    long long curcost = q.top().cst;
    bool f = q.top().f;
    q.pop();
    if (vis[curnode]) {
      ans += f;
      continue;
    }
    vis[curnode] = true;
    for (int i = 0; i < v[curnode].size(); i++) {
      int newnode = v[curnode][i].x;
      long long newcost = v[curnode][i].cst;
      if (!vis[newnode] && curcost + newcost < cost[newnode]) {
        cost[newnode] = curcost + newcost;
        q.push(edge(newnode, cost[newnode], 0));
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> z;
    v[x].push_back(edge(y, z, 0));
    v[y].push_back(edge(x, z, 0));
  }
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    q.push(edge(x, y, 1));
  }
  dijkstra();
  cout << ans;
  return 0;
}
