#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
inline int read() {
  int ret = 0;
  char ch = getchar();
  bool isf = false;
  while (!(ch >= '0' && ch <= '9')) {
    if (ch == '-') isf = true;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') ret = ret * 10 + (ch - '0'), ch = getchar();
  if (isf)
    return -ret;
  else
    return ret;
}
struct edges {
  int next, to;
  long long w;
} ed[maxn << 2];
int head[maxn], ip;
void add(int u, int v, long long w) {
  ed[++ip].next = head[u];
  ed[ip].to = v;
  ed[ip].w = w;
  head[u] = ip;
}
int n, m, q, f[maxn];
bool vis[maxn];
long long dis[maxn], inf;
vector<int> d[maxn];
void spfa() {
  queue<int> q;
  memset(vis, false, sizeof(vis));
  memset(dis, 0x3f, sizeof(dis));
  inf = dis[1];
  dis[1] = 0;
  vis[1] = true;
  q.push(1);
  int u, v, i;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    vis[u] = false;
    for (i = head[u]; i > 0; i = ed[i].next) {
      v = ed[i].to;
      if (dis[u] + ed[i].w < dis[v]) {
        dis[v] = dis[u] + ed[i].w;
        if (!vis[v]) {
          vis[v] = true;
          q.push(v);
        }
      }
    }
  }
}
struct nodes {
  long long val;
  int num;
};
struct cmp {
  bool operator()(nodes x, nodes y) { return x.val > y.val; }
};
void dijkstra() {
  priority_queue<nodes, vector<nodes>, cmp> q;
  memset(dis, 0x3f, sizeof(dis));
  inf = dis[1];
  dis[1] = 0;
  nodes st;
  st.num = 1;
  st.val = 0;
  q.push(st);
  int u, v;
  while (!q.empty()) {
    u = q.top().num;
    q.pop();
    vis[u] = true;
    for (int i = head[u]; i; i = ed[i].next) {
      v = ed[i].to;
      if (dis[v] > dis[u] + ed[i].w) {
        dis[v] = dis[u] + ed[i].w;
        st.num = v;
        st.val = dis[v];
        q.push(st);
      }
    }
  }
}
int main() {
  n = read();
  m = read();
  q = read();
  int x, y, z;
  for (int i = 1; i <= m; i++) {
    x = read();
    y = read();
    z = (long long)read();
    add(x, y, z);
  }
  dijkstra();
  int zl;
  while (q--) {
    zl = read();
    if (zl == 1) {
      x = read();
      if (dis[x] >= inf)
        printf("-1\n");
      else
        printf("%I64d\n", dis[x]);
    } else {
      for (int i = read(); i > 0; i--) ed[read()].w++;
      memset(f, 0x3f, sizeof(f));
      int mx = 0;
      f[1] = 0;
      d[0].push_back(1);
      for (int i = 0; i <= mx; i++)
        for (int j = 0; j < d[i].size(); j++) {
          x = d[i][j];
          if (i > f[x]) continue;
          for (int k = head[x]; k; k = ed[k].next) {
            int v = ed[k].to;
            if (f[v] > f[x] + dis[x] + ed[k].w - dis[v]) {
              f[v] = f[x] + dis[x] + ed[k].w - dis[v];
              if (f[v] <= n) d[f[v]].push_back(v), mx = max(mx, f[v]);
            }
          }
        }
      for (int i = 0; i <= mx; i++) d[i].clear();
      for (int i = 1; i <= n; i++)
        if (dis[i] < inf) dis[i] += f[i];
    }
  }
  return 0;
}
