Problem: You are given a weighted directed graph, consisting of n vertices and m edges. You should answer q queries of two types:

  * 1 v — find the length of shortest path from vertex 1 to vertex v. 
  * 2 c l1 l2 ... lc — add 1 to weights of edges with indices l1, l2, ..., lc. 

Input

The first line of input data contains integers n, m, q (1 ≤ n, m ≤ 105, 1 ≤ q ≤ 2000) — the number of vertices and edges in the graph, and the number of requests correspondingly.

Next m lines of input data contain the descriptions of edges: i-th of them contains description of edge with index i — three integers ai, bi, ci (1 ≤ ai, bi ≤ n, 0 ≤ ci ≤ 109) — the beginning and the end of edge, and its initial weight correspondingly.

Next q lines of input data contain the description of edges in the format described above (1 ≤ v ≤ n, 1 ≤ lj ≤ m). It's guaranteed that inside single query all lj are distinct. Also, it's guaranteed that a total number of edges in all requests of the second type does not exceed 106.

Output

For each query of first type print the length of the shortest path from 1 to v in a separate line. Print -1, if such path does not exists.

Examples

Input

3 2 9
1 2 0
2 3 0
2 1 2
1 3
1 2
2 1 1
1 3
1 2
2 2 1 2
1 3
1 2


Output

1
0
2
1
4
2


Input

5 4 9
2 3 1
2 4 1
3 4 1
1 2 0
1 5
1 4
2 1 2
2 1 2
1 4
2 2 1 3
1 4
2 1 4
1 4


Output

-1
1
2
3
4

Note

The description of changes of the graph in the first sample case:

<image>

The description of changes of the graph in the second sample case:

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
int head[100111], nxt[100111], from[100111], to[100111], cost[100111], tot;
void addedge(int u, int v, int w) {
  nxt[++tot] = head[u];
  head[u] = tot;
  from[tot] = u;
  to[tot] = v;
  cost[tot] = w;
}
long long dist[100111];
void dijkstra(int s) {
  memset(dist, -1, sizeof(dist));
  priority_queue<pair<long long, int> > q;
  q.push(make_pair(0, s));
  dist[s] = 0;
  while (!q.empty()) {
    int x = q.top().second;
    long long d = -q.top().first;
    q.pop();
    if (dist[x] != d) continue;
    for (int i = head[x]; i; i = nxt[i]) {
      if (dist[to[i]] == -1 || dist[to[i]] > d + cost[i]) {
        dist[to[i]] = d + cost[i];
        q.push(make_pair(-dist[to[i]], to[i]));
      }
    }
  }
}
int n, m, q, sum, tdist[100111];
vector<int> vs[1000111];
void update(int s) {
  if (sum == 0) return;
  memset(tdist, -1, sizeof(tdist));
  tdist[s] = 0;
  vs[0].push_back(s);
  int d = 0;
  while (true) {
    while (d <= sum && (int)vs[d].size() == 0) d++;
    if (d == sum + 1) break;
    int x = vs[d][(int)vs[d].size() - 1];
    vs[d].pop_back();
    if (tdist[x] != d) continue;
    for (int i = head[x]; i; i = nxt[i])
      if (d + cost[i] <= sum) {
        if (tdist[to[i]] == -1 || tdist[to[i]] > d + cost[i]) {
          tdist[to[i]] = d + cost[i];
          vs[tdist[to[i]]].push_back(to[i]);
        }
      }
  }
  sum = 0;
  for (int i = 1; i <= m; i++)
    if (dist[from[i]] != -1) cost[i] = tdist[from[i]] + cost[i] - tdist[to[i]];
  for (int i = 1; i <= n; i++)
    if (dist[i] != -1) dist[i] += tdist[i];
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1, u, v, w; i <= m; i++) {
    cin >> u >> v >> w;
    addedge(u, v, w);
  }
  dijkstra(1);
  for (int i = 1; i <= m; i++)
    if (dist[from[i]] != -1) cost[i] = dist[from[i]] + cost[i] - dist[to[i]];
  for (int i = 1, op, x, y; i <= q; i++) {
    cin >> op >> x;
    if (op == 1) {
      if (dist[x] == -1)
        cout << -1 << endl;
      else {
        update(1);
        cout << dist[x] << endl;
      }
    } else {
      sum += x;
      while (x--) {
        cin >> y;
        cost[y]++;
      }
    }
  }
  return 0;
}