#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
using ll = long long;
char buf[1 << 24], *p1 = buf, *p2 = buf;
char getch() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 24, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
void read(int &x) {
  int num = 0, f = 1;
  char ch = getch();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getch();
  }
  while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getch();
  x = num * f;
}
struct edge {
  int to, nex, w;
} e[maxn << 1];
int head[maxn], cnt;
void add(int a, int b, int c) {
  e[++cnt] = (edge){b, head[a], c};
  head[a] = cnt;
}
struct node {
  int u;
  ll d;
  bool operator<(const node &h) const { return d > h.d; }
};
ll dis[maxn];
priority_queue<node> Q;
void DJ() {
  memset(dis, 0x3f, sizeof dis);
  dis[1] = 0;
  Q.emplace((node){1, 0});
  while (!Q.empty()) {
    ll u = Q.top().u, d = Q.top().d;
    Q.pop();
    if (d != dis[u]) continue;
    for (int i = head[u]; i; i = e[i].nex) {
      int v = e[i].to;
      if (dis[v] > dis[u] + e[i].w) {
        dis[v] = dis[u] + e[i].w;
        Q.emplace((node){v, dis[v]});
      }
    }
  }
}
int t[maxn];
queue<int> w[maxn];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n, m, q;
  read(n), read(m), read(q);
  for (int i = 1; i <= m; ++i) {
    int a, b, c;
    read(a), read(b), read(c);
    add(a, b, c);
  }
  DJ();
  for (int _ = 1; _ <= q; ++_) {
    int opt, x, r;
    read(opt);
    switch (opt) {
      case 1:
        read(x);
        cout << (dis[x] <= 1e15 ? dis[x] : -1) << '\n';
        break;
      case 2:
        read(x);
        for (int i = 1; i <= x; ++i) {
          read(r), ++e[r].w;
        }
        memset(t, 0x3f, sizeof t);
        w[t[1] = 0].emplace(1);
        for (int j = 0; j <= x; ++j) {
          while (!w[j].empty()) {
            int u = w[j].front();
            w[j].pop();
            if (t[u] != j) continue;
            for (int i = head[u]; i; i = e[i].nex) {
              int v = e[i].to;
              int tmp = dis[u] + e[i].w + t[u] - dis[v];
              if (tmp > x) continue;
              if (t[v] > tmp) w[t[v] = tmp].emplace(v);
            }
          }
        }
        for (int i = 1; i <= n; ++i)
          if (t[i] < 1e5) dis[i] += t[i];
        break;
    }
  }
  return 0;
}
