#include <bits/stdc++.h>
using namespace std;
int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string itos(long long i) {
  string s = "";
  while (i) {
    s += char(i % 10 + '0');
    i /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
long long stoi(string &s) {
  long long tot = 0;
  for (int i = (int)s.length() - 1, j = 1; i >= 0; i--, j *= 10) {
    tot += j * (s[i] + '0');
  }
  return tot;
}
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
long long pwr(long long base, long long p, long long mod = 1000000007) {
  long long ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % 1000000007;
    base = (base * base) % 1000000007;
    p /= 2;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b * 1LL) / gcd(a, b); }
const int N = 1e6 + 5;
int n, m, k, cnt = 0;
long long dist[N];
vector<pair<pair<int, long long>, int> > adj[N];
priority_queue<pair<pair<long long, int>, int>,
               vector<pair<pair<long long, int>, int> >,
               greater<pair<pair<long long, int>, int> > >
    q;
void dijkstra(int src) {
  for (int i = 1; i < N; i++) dist[i] = 1e18;
  q.push(make_pair(make_pair(0, 0), src));
  while (!q.empty()) {
    pair<pair<long long, int>, int> p = q.top();
    q.pop();
    int u = p.second;
    long long d = p.first.first;
    int t = p.first.second;
    if (dist[u] != 1e18) continue;
    dist[u] = d;
    if (t == 1) cnt++;
    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i].first.first;
      long long w = adj[u][i].first.second;
      int t = adj[u][i].second;
      if (dist[v] > w + d) {
        q.push(make_pair(make_pair(w + d, t), v));
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  clock_t clk;
  clk = clock();
  cin >> n >> m >> k;
  for (int i = (1); i <= (m); ++i) {
    int x, y, w;
    cin >> x >> y >> w;
    adj[x].push_back(make_pair(make_pair(y, w), 0));
    adj[y].push_back(make_pair(make_pair(x, w), 0));
  }
  for (int i = (1); i <= (k); ++i) {
    int x, w;
    cin >> x >> w;
    adj[1].push_back(make_pair(make_pair(x, w), 1));
    adj[x].push_back(make_pair(make_pair(1, w), 1));
  }
  dijkstra(1);
  cnt = k - cnt;
  cout << cnt;
  clk = clock() - clk;
  cerr << fixed << setprecision(6) << "Time: " << ((double)clk) / CLOCKS_PER_SEC
       << "\n";
  return 0;
}
