#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
typedef int ll;
using namespace std;
ll n,i,j,k,x,y,w,m,Q, used[100500], start;
ll a[100500], b[100500], c[100500];
vector<pii> g[100500];
queue<ll> f[1000500];
long long d[100500];
long long hea[200500];
int new_w[100500], new_d[100500];
int hea2[200500];
int st[100500], sz[100500], cur_pos[100500];
int G[100500];
ll heapSize;
void add(pair<long long,int> value)
{
    hea[heapSize++] = value.X;
    int i = heapSize - 1;
    hea2[i] = value.Y;
    int parent = ((i - 1)>>1);
    while (i > 0 && hea[parent] < hea[i])
    {
        swap(hea[i], hea[parent]);
        swap(hea2[i], hea2[parent]);
        i = parent;
        parent = ((i - 1)>>1);
    }
}
void heapify(int i)
{
    int largestChild;

    for (; ; )
    {
        largestChild = i;

        if (hea[2 * i + 1] > hea[largestChild])
        {
            largestChild = 2 * i + 1;
        }

        if (hea[2 * i + 2] > hea[largestChild])
        {
            largestChild = 2 * i + 2;
        }

        if (largestChild == i)
        {
            break;
        }

        swap(hea[i], hea[largestChild]);
        swap(hea2[i], hea2[largestChild]);
        i = largestChild;
    }
}
pair<long long,int> getMax()
{
    pii result = mp(hea[0],hea2[0]);

    heapSize--;
    hea[0] = hea[heapSize];
    hea2[0] = hea2[heapSize];
    hea[heapSize] = -(long long)1e+18;
    heapify(0);
    return result;
}

inline unsigned int readUInt()
{
  int c = getc(stdin);
  unsigned int x = 0;
  while (c <= 32)
    c = getc(stdin);
  while ('0' <= c && c <= '9')
    x = x * 10 + c - '0', c = getc(stdin);
  return x;
}
int main() {
    //freopen("input.txt", "r", stdin);
    cin >> n >> m >> Q;
    for (i = 0; i <= 200000; i++)
        hea[i] = -(long long)1e+18;
    for (i = 0; i < m; i++)
    {
        int x,y,z;
        a[i] = readUInt();
        b[i] = readUInt();
        c[i] = readUInt();
    }
    int s = 1;
    for (i = 0; i < m; i++)
    {
        g[a[i]].push_back(mp(b[i], c[i]));
    }
    st[1] = 0;
    sz[1] = g[1].size();
    for (i = 2; i <= n; i++)
    {
        st[i] = cur_pos[i] = st[i-1] + g[i-1].size();
        sz[i] = g[i].size();
    }
    for (i = 0; i < m; i++)
    {
        G[cur_pos[a[i]]++] = i;
    }
    for (i = 1; i <= n; i++)
        d[i] = (long long)1e+18;
    d[s] = 0;
    for (i = 0; i < heapSize; i++)
        hea[i] = -(long long)1e+18;
    heapSize = 0;
    add(make_pair (0, s));
    while (heapSize) {
        pii tmp = getMax();
        int v = tmp.second; long long cur_d = -tmp.first;
        if (cur_d > d[v])  continue;

        for (size_t j=0; j<g[v].size(); ++j) {
            int to = g[v][j].first;
            long long len = g[v][j].second;
            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                add(make_pair (-d[to], to));
            }
        }
    }
    for (i = 0; i < m; i++)
        new_w[i] = min(100000000LL, c[i] + d[a[i]] - d[b[i]]);
    int last_test = 1;
    for (int ii = 0; ii < Q; ii++)
    {
        ll test;
        cin >> test;
        if (test == 1)
        {
            if (last_test == 2)
            {
                for (i = 0; i <= n; i++)
                {
                    new_d[i] = (int)1e+9;
                }
                f[0].push(1);
                new_d[1] = 0;
                for (i = 0; i <= x; i++)
                {
                    while (!f[i].empty())
                    {
                        int v = f[i].front();
                        f[i].pop();
                        if (new_d[v] == i)
                        {
                            int tmp = st[v] + sz[v];
                            for (k = st[v]; k < tmp; k++)
                            {
                                int to = b[G[k]];
                                int val = new_w[G[k]];
                                if (new_d[to] > i + val)
                                {
                                    new_d[to] = min(100000000, i + val);
                                    if (new_d[to] <= x)
                                        f[new_d[to]].push(to);
                                }
                            }
                        }
                    }
                }
                for (i = 1; i <= n; i++)
                {
                    d[i] += new_d[i];
                    if (d[i] > (long long)1e+18)
                        d[i] = (long long)1e+18;
                }
                for (i = 0; i < m; i++)
                    new_w[i] = min(100000000LL, c[i] + d[a[i]] - d[b[i]]);
            }
            ll t;
            cin >> t;
            if (d[t] == (long long)1e+18)
                cout << -1 << endl;
            else
                cout << d[t] << endl;
        } else
        {
            int tmp;
            if (last_test == 1)
                x = 0;
            cin >> tmp;
            for (i = 0; i < tmp; i++)
            {
                int y = readUInt();
                new_w[y-1]++;
                c[y-1]++;
            }
            x += tmp;
        }
        last_test = test;
    }
    return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,w,m,Q, used[100500], start;
pair<pii,ll> a[100500];
vector<pii> g[200500];
ll d[100500], p[100500];
priority_queue < pair<ll,ll> > q;
int main() {
    //freopen("input.txt", "r", stdin);
    cin >> n >> m >> Q;
    for (i = 0; i < m; i++)
    {
        int x,y,z;
        scanf("%d %d %d",&x,&y,&z);
        a[i] = mp(mp(x,y),z);
    }
    for (int ii = 0; ii < Q; ii++)
    {
        ll test;
        cin >> test;
        if (test == 1)
        {
            ll t;
            cin >> t;
            int s = 1;
            for (i = 1; i <= n; i++)
                g[i].clear();
            for (i = 0; i < m; i++)
            {
                g[a[i].X.X].push_back(mp(a[i].X.Y, a[i].Y));
                g[a[i].X.Y].push_back(mp(a[i].X.X, a[i].Y));
            }
            for (i = 1; i <= n; i++)
                d[i] = (ll)1e+18;
            d[s] = 0;
            while (!q.empty())
                q.pop();
            q.push (make_pair (0, s));
            while (!q.empty()) {
                ll v = q.top().second,  cur_d = -q.top().first;
                if (v == t)
                    break;
                q.pop();
                if (cur_d > d[v])  continue;

                for (size_t j=0; j<g[v].size(); ++j) {
                    ll to = g[v][j].first,
                        len = g[v][j].second;
                    if (d[v] + len < d[to]) {
                        d[to] = d[v] + len;
                        p[to] = v;
                        q.push (make_pair (-d[to], to));
                    }
                }
            }
            if (d[t] == (ll)1e+18)
                cout << -1 << endl;
            else
                cout << d[t] << endl;
        } else
        {
            cin >> x;
            for (i = 0; i < x; i++)
            {
                cin >> y;
                a[y-1].Y++;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,w,m,Q, used[100500], start;
pair<pii,ll> a[100500];
vector<pii> g[200500];
ll d[100500], p[100500];
priority_queue < pair<ll,ll> > q;
int main() {
    //freopen("input.txt", "r", stdin);
    cin >> n >> m >> Q;
    for (i = 0; i < m; i++)
    {
        int x,y,z;
        scanf("%d %d %d",&x,&y,&z);
        a[i] = mp(mp(x,y),z);
    }
    for (int ii = 0; ii < Q; ii++)
    {
        ll test;
        cin >> test;
        if (test == 1)
        {
            ll t;
            cin >> t;
            int s = 1;
            for (i = 1; i <= n; i++)
                g[i].clear();
            for (i = 0; i < m; i++)
            {
                g[a[i].X.X].push_back(mp(a[i].X.Y, a[i].Y));
            }
            for (i = 1; i <= n; i++)
                d[i] = (ll)1e+18;
            d[s] = 0;
            while (!q.empty())
                q.pop();
            q.push (make_pair (0, s));
            while (!q.empty()) {
                ll v = q.top().second,  cur_d = -q.top().first;
                if (v == t)
                    break;
                q.pop();
                if (cur_d > d[v])  continue;

                for (size_t j=0; j<g[v].size(); ++j) {
                    ll to = g[v][j].first,
                        len = g[v][j].second;
                    if (d[v] + len < d[to]) {
                        d[to] = d[v] + len;
                        p[to] = v;
                        q.push (make_pair (-d[to], to));
                    }
                }
            }
            if (d[t] == (ll)1e+18)
                cout << -1 << endl;
            else
                cout << d[t] << endl;
        } else
        {
            cin >> x;
            for (i = 0; i < x; i++)
            {
                cin >> y;
                a[y-1].Y++;
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,m,Q,op,x,head[100010],o=0,a[100010];
long long dis[100010];
bool vis[100010];
struct edge{
	int to,link,w;
}e[100010];
void add_edge(int u,int v,int w){
	e[++o].to=v,e[o].link=head[u],head[u]=o,e[o].w=w;
}
struct node{
	int id;
	long long w;
	bool operator <(const node &b)const{
		return w>b.w;
	}
};
void dijk(){
	priority_queue<node>q;
	for(int i=1;i<=n;i++) dis[i]=1e18;
	q.push((node){1,dis[1]=0});
	while(!q.empty()){
		node now=q.top();q.pop();
		if(vis[now.id]) continue;
		vis[now.id]=true;
		for(int i=head[now.id];i;i=e[i].link){
			if(dis[e[i].to]>dis[now.id]+e[i].w){
				dis[e[i].to]=dis[now.id]+e[i].w;
				q.push((node){e[i].to,dis[e[i].to]});
			}
		}
	}
}
queue<int>q[100010];
void bfs(){
	for(int i=1;i<=n;i++) a[i]=2e9;
	a[1]=0,q[0].push(1);
	for(int i=0,ed=0;i<=ed;i++){
		while(!q[i].empty()){
			int now=q[i].front();q[i].pop();
			if(a[now]<i) continue;
			for(int j=head[now];j;j=e[j].link){
				int c=dis[now]+e[j].w-dis[e[j].to];
				if(a[e[j].to]>a[now]+c){
					a[e[j].to]=a[now]+c;
					if(a[e[j].to]<=min(x,n-1)){
						q[a[e[j].to]].push(e[j].to);
						ed=max(ed,a[e[j].to]);
					}
				}
			}
		}
	}
}
int main(){
	scanf("%d %d %d",&n,&m,&Q);
	for(int i=1,u,v,w;i<=m;i++) scanf("%d %d %d",&u,&v,&w),add_edge(u,v,w);
	dijk();
	while(Q--){
		scanf("%d %d",&op,&x);
		if(op==1) printf("%lld\n",dis[x]>=1e18?-1:dis[x]);
		if(op==2){
			for(int i=1,id;i<=x;i++) scanf("%d",&id),e[id].w++;
			bfs();
			for(int i=1;i<=n;i++) dis[i]=min(1000000000000000000ll,dis[i]+a[i]);
		}
	}
}


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int n,m,q;
ll dist[100001];
int lst = -MOD;
map<int,int> adj[100001];
vector<pii> edge;

void path() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pii,vector<pii>,greater<pii>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pii x = todo.top();
        todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) if (dist[i] == 1e18) dist[i] = -1;
}

int main() {
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        adj[a][b] = c;
        edge.pb({a,b});
    }
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (lst == i-1) {
                cout << dist[v] << "\n";
                continue;
            }
            path(); lst = i;
            cout << dist[v] << "\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f][edge[l].s] ++;
            }
        }
    }
}

// read!
// ll vs. int!


// http://codeforces.com/contest/843/submission/29865574
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int N = 1e5+5;
const ll INF = 1e18;

int Begin[N], Next[N], to[N], cost[N], e;

void Add(int u, int v, int w){
	to[++e] = v, Next[e] = Begin[u], Begin[u] = e, cost[e] = w;
}

int n, m;
ll dis[N];
bool vis[N];

struct Vertex{
	int o;
	ll d;
	bool operator < (const Vertex& A) const{
		return d > A.d;
	}
};

void Dijkstra(){
	priority_queue<Vertex> q;
	FOR(i,1,n+1) dis[i] = INF;
	q.push((Vertex){1, 0}), dis[1] = 0;
	while(!q.empty()){
		Vertex v = q.top(); q.pop();
		int o = v.o;
		if(vis[o]) continue;
		vis[o] = true;
		for(int i = Begin[o]; i; i = Next[i]){
			int u = to[i];
			if(dis[u] > dis[o] + cost[i]){
				dis[u] = dis[o] + cost[i];
				q.push((Vertex){u, dis[u]});
			}
		}
	}
}

int delt[N];
queue<int> que[N];

void Work(int s){
	FOR(i,1,n+1) delt[i] = 1e9, vis[i] = false;
	que[0].push(1), delt[1] = 0;
	F0R(i,s+1)
		while(!que[i].empty()){
			int o = que[i].front(); que[i].pop();
			if(vis[o]) continue;
			vis[o] = true;
			for(int j = Begin[o]; j; j = Next[j]){
				int u = to[j];
				int new_delt = dis[o] + delt[o] + cost[j] - dis[u];
				if(delt[u] > new_delt){
					delt[u] = new_delt;
					if(delt[u] <= s) que[delt[u]].push(u);
				}
			}
		}
	FOR(i,1,n+1) dis[i] += delt[i];
};

int q;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
	FOR(i,1,m+1) {
		int u, v, c; cin >> u >> v >> c;
		Add(u, v, c);
	}
	Dijkstra();
	while(q--){
		int ty, s; cin >> ty >> s;
		if(ty == 1) {
		    if (dis[s] < INF) cout << dis[s] << "\n";
		    else cout << "-1\n";
		} else{
			F0R(i,s) {
				int u; cin >> u;
				++cost[u];
			}
			Work(min(s, n));
		}
	}
}


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int n,m,q;
ll dist[100001];
bool need = 1;
vector<pii> adj[100001];
vector<pair<pii,int>> edge;

void path() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pii,vector<pii>,greater<pii>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pii x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) if (dist[i] == 1e18) dist[i] = -1;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        edge.pb({{a,b},adj[a].size()});
        adj[a].pb({b,c});
    }
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (need) {
                path();
                need = 0;
            }
            cout << dist[v] << "\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f.f][edge[l].s].s ++;
            }
            need = 1;
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);
const ll INF = 1e18;

int n,m,q;
ll dist[100001];
bool need = 1;
vector<pii> adj[100001];
vector<pair<pii,int>> edge;

void solve() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pii,vector<pii>,greater<pii>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pii x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += dist[i]-dist[j.f];

}

int newdist[100001], done[100001], when;
vi g[100001];

void update(){
	FOR(i,1,n+1) newdist[i] = n;
	newdist[1] = 0;
	F0R(i,n+1) g[i].clear();
	g[0].pb(1);
	++when;

	F0R(level,n) {
		F0R(j,g[level].size()) {
			int node = g[level][j];
			if (done[node] == when) continue;
			done[node] = when;
			for(pii y : adj[node]){
				if(newdist[y.f] > level+y.s) {
					newdist[y.f] = level+y.s;
					g[newdist[y.f]].pb(y.f);
				}
			}
		}
	}

    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += newdist[i]-newdist[j.f];
	FOR(i,1,n+1) dist[i] += newdist[i];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        edge.pb({{a,b},adj[a].size()});
        adj[a].pb({b,c});
    }
    solve();
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (dist[v] < INF) cout << dist[v] << "\n";
            else cout << "-1\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f.f][edge[l].s].s ++;
            }
            update();
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);
const ll INF = 1e18;

int n,m,q;
ll dist[100001];
bool need = 1;
vi adj[100001];
vector<pair<pii,int>> edge;

void solve() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pll,vector<pll>,greater<pll>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pll x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (int y: adj[x.s]) {
            int nex = edge[y].f.s, wei = edge[y].s;
            if (dist[nex] > x.f+wei) {
                dist[nex] = x.f+wei;
                todo.push({dist[nex],nex});
            }
        }
    }
    for (auto& a: edge) a.s += dist[a.f.f]-dist[a.f.s];
}

int newdist[100001], done[100001], when;
vi g[100001];

void update(){
	FOR(i,1,n+1) newdist[i] = n;
	newdist[1] = 0;
	F0R(i,n+1) g[i].clear();
	g[0].pb(1);
	++when;

	F0R(level,n) {
		F0R(j,g[level].size()) {
			int node = g[level][j];
			if (done[node] == when) continue;
			done[node] = when;
			for(int y : adj[node]) {
			    int nex = edge[y].f.s, wei = edge[y].s;
				if(newdist[nex] > level+wei) {
					newdist[nex] = level+wei;
					g[newdist[nex]].pb(nex);
				}
			}
		}
	}

    for (auto& a: edge) a.s += newdist[a.f.f]-newdist[a.f.s];
	FOR(i,1,n+1) dist[i] += newdist[i];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        adj[a].pb(edge.size());
        edge.pb({{a,b},c});
    }
    solve();
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (dist[v] < INF) cout << dist[v] << "\n";
            else cout << "-1\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                edge[l].s ++;
            }
            update();
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);
const ll INF = 1e18;

int n,m,q;
ll dist[100001];
bool need = 1;
vector<pii> adj[100001];
vector<pair<pii,int>> edge;

void solve() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pll,vector<pll>,greater<pll>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pll x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += dist[i]-dist[j.f];
}

int newdist[100001], done[100001], when;
vi g[100001];

void update(){
	FOR(i,1,n+1) newdist[i] = n;
	newdist[1] = 0;
	F0R(i,n+1) g[i].clear();
	g[0].pb(1);
	++when;

	int mx = 0;
	F0R(level,mx+1) {
		F0R(j,g[level].size()) {
			int node = g[level][j];
			if (done[node] == when) continue;
			done[node] = when;
			for(pii y : adj[node]){
				if(newdist[y.f] > level+y.s) {
					newdist[y.f] = level+y.s;
					mx = max(mx,newdist[y.f]);
					g[newdist[y.f]].pb(y.f);
				}
			}
		}
	}

    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += newdist[i]-newdist[j.f];
	FOR(i,1,n+1) dist[i] += newdist[i];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        edge.pb({{a,b},adj[a].size()});
        adj[a].pb({b,c});
    }
    solve();
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (dist[v] < INF) cout << dist[v] << "\n";
            else cout << "-1\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f.f][edge[l].s].s ++;
            }
            update();
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef pair<int,int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);
const ll INF = 1e18;

int n,m,q;
ll dist[100001];
bool need = 1;
vi adj[100001];
vector<pair<pii,ll>> edge;

void solve() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pll,vector<pll>,greater<pll>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pll x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (int y: adj[x.s]) {
            int nex = edge[y].f.s, wei = edge[y].s;
            if (dist[nex] > x.f+wei) {
                dist[nex] = x.f+wei;
                todo.push({dist[nex],nex});
            }
        }
    }
    for (auto& a: edge) a.s += dist[a.f.f]-dist[a.f.s];
}

int newdist[100001], done[100001], when;
vi g[100001];

void update(){
	FOR(i,1,n+1) newdist[i] = n;
	newdist[1] = 0;
	F0R(i,n+1) g[i].clear();
	g[0].pb(1);
	++when;

	F0R(level,n) {
		F0R(j,g[level].size()) {
			int node = g[level][j];
			if (done[node] == when) continue;
			done[node] = when;
			for(int y : adj[node]) {
			    int nex = edge[y].f.s, wei = edge[y].s;
				if(newdist[nex] > level+wei) {
					newdist[nex] = level+wei;
					g[newdist[nex]].pb(nex);
				}
			}
		}
	}

    for (auto& a: edge) a.s += newdist[a.f.f]-newdist[a.f.s];
	FOR(i,1,n+1) dist[i] += newdist[i];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        adj[a].pb(edge.size());
        edge.pb({{a,b},c});
    }
    solve();
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (dist[v] < INF) cout << dist[v] << "\n";
            else cout << "-1\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                edge[l].s ++;
            }
            update();
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

int n,m,q;
ll dist[100001];
int lst = -MOD;
map<int,int> adj[100001];
vector<pii> edge;

void path() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pii,vector<pii>,greater<pii>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pii x = todo.top();
        todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) if (dist[i] == 1e18) dist[i] = -1;
}

int main() {
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        adj[a][b] = c;
        edge.pb({a,b});
    }
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (lst == i-1) {
                cout << dist[v] << "\n";
                continue;
            }
            path(); lst = i;
            cout << dist[v] << "\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f][edge[l].s] ++;
            }
        }
    }
}

// read!
// ll vs. int!


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef vector<int> vi;
typedef pair<ll, ll> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);
const ll INF = 1e18;

int n,m,q;
ll dist[100001];
bool need = 1;
vector<pii> adj[100001];
vector<pair<pii,int>> edge;

void solve() {
    FOR(i,1,n+1) dist[i] = 1e18;
    priority_queue<pii,vector<pii>,greater<pii>> todo;
    dist[1] = 0;
    todo.push({0,1});
    while (todo.size()) {
        pii x = todo.top(); todo.pop();
        if (x.f > dist[x.s]) continue;
        for (pii y: adj[x.s]) if (dist[y.f] > x.f+y.s) {
            dist[y.f] = x.f+y.s;
            todo.push({dist[y.f],y.f});
        }
    }
    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += dist[i]-dist[j.f];

}

int newdist[100001], done[100001], when;
vi g[100001];

void update(){
	FOR(i,1,n+1) newdist[i] = n;
	newdist[1] = 0;
	F0R(i,n+1) g[i].clear();
	g[0].pb(1);
	++when;

	F0R(level,n) {
		F0R(j,g[level].size()) {
			int node = g[level][j];
			if (done[node] == when) continue;
			done[node] = when;
			for(pii y : adj[node]){
				if(newdist[y.f] > level+y.s) {
					newdist[y.f] = level+y.s;
					g[newdist[y.f]].pb(y.f);
				}
			}
		}
	}

    FOR(i,1,n+1) for (pii& j: adj[i]) j.s += newdist[i]-newdist[j.f];
	FOR(i,1,n+1) dist[i] += newdist[i];
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n >> m >> q;
    F0R(i,m) {
        int a,b,c; cin >> a >> b >> c;
        edge.pb({{a,b},adj[a].size()});
        adj[a].pb({b,c});
    }
    solve();
    F0R(i,q) {
        int t; cin >> t;
        if (t == 1) {
            int v; cin >> v;
            if (dist[v] != INF) cout << dist[v] << "\n";
            else cout << "-1\n";
        } else {
            int c; cin >> c;
            F0R(j,c) {
                int l; cin >> l; l--;
                adj[edge[l].f.f][edge[l].s].s ++;
            }
            update();
        }
    }
}

// read!
// ll vs. int!


#include <bits/stdc++.h>
#define N 100004
#define LL long long
#define inf 1000000000000000
using namespace std;
int go[N];
namespace IO
{
    char *p1, *p2, buf[100000];
    #define nc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1 ++ )
    inline int rd() {
        int x = 0;
        char c = nc();
        while (c < 48) {
            c = nc();
        }
        while (c > 47) {
            x = (((x << 2) + x) << 1) + (c ^ 48), c = nc();
        }
        return x;
    }
    inline void setIO(string s)
    {
        string in=s+".in";
        string out=s+".out";
        freopen(in.c_str(),"r",stdin);
        freopen(out.c_str(),"w",stdout);
    }
};
LL d[N];
vector<int>G[N];
int n,m,Q,done[N],inq[N];
struct edge
{
    LL val;
    int u,v;
}ee[N];
deque<int>q;
void dijkstra()
{
    for(int i=1;i<=n;++i) d[i]=inf,inq[i]=0;
    d[1]=0, inq[1]=1;
    q.push_back(1);
    while(!q.empty())
    {
        int u=q.front(); q.pop_front();
        for(int i=G[u].size()-1;i>=0;--i)
        {
            edge e=ee[G[u][i]];
            inq[e.u]=0;
            if(d[e.v]>d[u]+e.val)
            {
                d[e.v]=d[u]+e.val;
                if(!inq[e.v])
                {
                    if(q.empty()||d[e.v]<d[q.front()]) q.push_front(e.v);
                    else q.push_back(e.v);
                    inq[e.v]=1;
                }
            }
        }
    }
}
int main()
{
    // int t=clock();
    // IO::setIO("input");
    int i,j,flag=1;
    n=IO::rd();
    m=IO::rd();
    Q=IO::rd();
    // scanf("%d%d%d",&n,&m,&Q);
    for(i=1;i<=m;++i)
    {
        ee[i].u=IO::rd();
        ee[i].v=IO::rd();
        ee[i].val=IO::rd();
        G[ee[i].u].push_back(i);
    }
    dijkstra();
    for(i=1;i<=n;++i)  if(d[i]==inf)   go[i]=0;   else go[i]=1;
    for(i=1;i<=Q;++i)
    {
        int opt,pp;
        opt=IO::rd();
        pp=IO::rd();
        // scanf("%d%d",&opt,&pp);
        if(opt==2)
        {
            for(j=1;j<=pp;++j)
            {
                int x=IO::rd();
                ++ee[x].val;
            }
            flag=0;
        }
        else
        {
            if(!go[pp])
            {
                printf("-1\n");
            }
            else
            {
                if(!flag)
                {
                    flag=1;
                    dijkstra();
                }
                printf("%lld\n",d[pp]);
            }
        }
    }
    // printf("%d\n",clock()-t);
    return 0;
}


#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;

typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;

template <typename _T>
inline void read(_T &f) {
	f = 0; _T fu = 1; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar(); }
	while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar(); }
	f *= fu;
}

template <typename T>
void print(T x) {
	if (x < 0) putchar('-'), x = -x;
	if (x < 10) putchar(x + 48);
	else print(x / 10), putchar(x % 10 + 48);
}

template <typename T>
void print(T x, char t) {
	print(x); putchar(t);
}

const ll INF = 0x7f7f7f7f7f7f7f7f;
const int N = 1e5 + 5;

struct edge_t { int u, v, next, w, id; } G[N];

priority_queue < pair <ll, int> > Q;
queue <int> que[N];
ll dis[N];
int head[N], add[N], I[N];
int n, m, q, tot;

inline void addedge(int u, int v, int w, int id) {
	G[++tot] = (edge_t) {u, v, head[u], w, id}, head[u] = tot;
}

int main() {
	memset(dis, 0x7f, sizeof(dis));
	read(n); read(m); read(q);
	for (int i = 1; i <= m; i++) {
		int u, v, w;
		read(u); read(v); read(w);
		addedge(u, v, w, i);
	}
	dis[1] = 0; Q.push(make_pair(0, 1));
	while (!Q.empty()) {
		pair <ll, int> u = Q.top(); Q.pop();
		if (-u.first > dis[u.second]) continue;
		for (int i = head[u.second]; i; i = G[i].next) {
			int v = G[i].v;
			if (dis[v] > dis[u.second] + G[i].w) {
				dis[v] = dis[u.second] + G[i].w;
				Q.push(make_pair(-dis[v], v));
			}
		}
	}
	while (q--) {
		int opt; read(opt);
		if (opt == 1) {
			int x; read(x);
			print(dis[x] == INF ? -1 : dis[x], '\n');
		} else {
			memset(add, 0x7f, sizeof(add)); memset(I, 0, sizeof(I));
			int k; read(k);
			for (int i = 1, id; i <= k; i++) read(id), I[id] = 1;
			add[1] = 0; que[0].push(1);
			for (int v = 0; v <= k; v++) {
				while (!que[v].empty()) {
					int u = que[v].front(); que[v].pop();
					// cout << ": " << u << " " << v << endl;
					if (v > add[u]) continue;
					for (int i = head[u]; i; i = G[i].next) {
						if (add[G[i].v] > add[u] + dis[u] + G[i].w + I[G[i].id] - dis[G[i].v]) {
							add[G[i].v] = add[u] + dis[u] + G[i].w + I[G[i].id] - dis[G[i].v];
							if (add[G[i].v] <= k) que[add[G[i].v]].push(G[i].v);
						}
					}
				}
			}
			for (int i = 1; i <= n; i++) if (add[i] != 0x7f7f7f7f) dis[i] += add[i];
			for (int i = 1; i <= m; i++) G[i].w += I[G[i].id];
		}
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <tuple>
#include <iostream>
using namespace std;

inline void read( int & x ){
	x = 0;
	char ch = getchar();
	for( ; ch < '0' || ch > '9' ; ch = getchar() );
	for( ; ch >= '0' && ch <= '9' ; ch = getchar() ) x = x * 10 + ch - '0';
}

const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e5 + 50;
tuple < int , int , int > Edge[maxn];
int head[maxn] , n , m , Q , tot , from[maxn];
long long dist[maxn] , upd[maxn];
priority_queue < pair < long long , int > > pq;
queue < int > que[maxn * 10];

void Dijkstra(){
	memset( dist , 0x3f , sizeof( dist ) );
	dist[1] = 0;
	pq.push( make_pair( - dist[1] , 1 ) );
	while( !pq.empty() ){
		pair < long long , int > s = pq.top() ; pq.pop();
		long long y = - s.first;
		int x = s.second;
		if( dist[x] ^ y ) continue;
		for(int i = head[x] ; ~i ; i = get < 1 >( Edge[i] ) ){
			int v = get < 0 >( Edge[i] ) , c = get < 2 > ( Edge[i] );
			long long newy = y + c;
			if( newy < dist[v] ){
				dist[v] = newy;
				pq.push( make_pair( - dist[v] , v ) );
			}
		}
	}
}

int main( int argc , char * argv[] ){
	read( n ) , read( m ) , read( Q );
	memset( head , -1 , sizeof( head ) );
	for(int i = 1 ; i <= m ; ++ i){
		int u , v , c;
		read( u ) , read( v ) , read( c );
		Edge[tot] = make_tuple( v , head[u] , c );
		from[tot] = u;
		head[u] = tot ++ ;
	}
	Dijkstra();
	while( Q -- ){
		int tp , x;
		read( tp ) , read( x );
		if( tp == 1 ) printf( "%I64d\n" , dist[x] == inf ? -1 : dist[x] );
		else{
			for(int i = 0 ; i < x ; ++ i){
				int id ; read( id );
				-- id;
				++ get < 2 > ( Edge[id] );
			}
			memset( upd , 0x3f , ( n + 1 ) << 3 );
			que[0].push( 1 );
			upd[1] = 0;
			for(int i = 0 ; i <= x ; ++ i)
				while( !que[i].empty() ){
					int u = que[i].front(); que[i].pop();
					for(int j = head[u] ; ~j ; j = get < 1 > ( Edge[j] ) ){
						int v = get < 0 > ( Edge[j] );
						long long newc = upd[u] + dist[u] + get < 2 > ( Edge[j] ) - dist[v];
						if( newc < upd[v] ){
							upd[v] = newc;
							if( upd[v] <= x ){
								que[upd[v]].push( v );
							}
						}
					}
				}
			for(int i = 1 ; i <= n ; ++ i) if( upd[i] ^ inf ) dist[i] += upd[i];
		}
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <tuple>
#include <iostream>
using namespace std;

inline void read( int & x ){
	x = 0;
	char ch = getchar();
	for( ; ch < '0' || ch > '9' ; ch = getchar() );
	for( ; ch >= '0' && ch <= '9' ; ch = getchar() ) x = x * 10 + ch - '0';
}

const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e5 + 50;
tuple < int , int , int > Edge[maxn];
int head[maxn] , n , m , Q , tot;
long long dist[maxn] , upd[maxn];
priority_queue < pair < long long , int > > pq;
vector < int > que[maxn];

void Dijkstra(){
	memset( dist , 0x3f , sizeof( dist ) );
	dist[1] = 0;
	pq.push( make_pair( - dist[1] , 1 ) );
	while( !pq.empty() ){
		pair < long long , int > s = pq.top() ; pq.pop();
		long long y = - s.first;
		int x = s.second;
		if( dist[x] ^ y ) continue;
		for(int i = head[x] ; ~i ; i = get < 1 >( Edge[i] ) ){
			int v = get < 0 >( Edge[i] ) , c = get < 2 > ( Edge[i] );
			long long newy = y + c;
			if( newy < dist[v] ){
				dist[v] = newy;
				pq.push( make_pair( - dist[v] , v ) );
			}
		}
	}
}

int main( int argc , char * argv[] ){
	read( n ) , read( m ) , read( Q );
	memset( head , -1 , sizeof( head ) );
	for(int i = 1 ; i <= m ; ++ i){
		int u , v , c;
		read( u ) , read( v ) , read( c );
		Edge[tot] = make_tuple( v , head[u] , c );
		head[u] = tot ++ ;
	}
	Dijkstra();
	while( Q -- ){
		int tp , x;
		read( tp ) , read( x );
		if( tp == 1 ) printf( "%I64d\n" , dist[x] == inf ? -1 : dist[x] );
		else{
			for(int i = 0 ; i < x ; ++ i){
				int id ; read( id );
				-- id;
				++ get < 2 > ( Edge[id] );
			}
			memset( upd , 0x3f , ( n + 1 ) << 3 );
			que[0].emplace_back( 1 );
			upd[1] = 0;
			int mx = min( x , n - 1 );
			for(int i = 0 ; i <= mx ; ++ i)
				while( !que[i].empty() ){
					int u = que[i].back(); que[i].pop_back();
					if( upd[u] ^ i ) continue;
					for(int j = head[u] ; ~j ; j = get < 1 > ( Edge[j] ) ){
						int v = get < 0 > ( Edge[j] );
						long long newc = upd[u] + dist[u] + get < 2 > ( Edge[j] ) - dist[v];
						if( newc < upd[v] ){
							upd[v] = newc;
							if( upd[v] <= mx ){
								que[upd[v]].emplace_back( v );
							}
						}
					}
				}
			for(int i = 1 ; i <= n ; ++ i) if( upd[i] ^ inf ) dist[i] += upd[i];
		}
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <tuple>
#include <iostream>
using namespace std;

inline void read( int & x ){
	x = 0;
	char ch = getchar();
	for( ; ch < '0' || ch > '9' ; ch = getchar() );
	for( ; ch >= '0' && ch <= '9' ; ch = getchar() ) x = x * 10 + ch - '0';
}

const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1e5 + 50;
tuple < int , int , int > Edge[maxn];
int head[maxn] , n , m , Q , tot , from[maxn];
long long dist[maxn] , upd[maxn];
priority_queue < pair < long long , int > > pq;
vector < int > que[maxn * 10];

void Dijkstra(){
	memset( dist , 0x3f , sizeof( dist ) );
	dist[1] = 0;
	pq.push( make_pair( - dist[1] , 1 ) );
	while( !pq.empty() ){
		pair < long long , int > s = pq.top() ; pq.pop();
		long long y = - s.first;
		int x = s.second;
		if( dist[x] ^ y ) continue;
		for(int i = head[x] ; ~i ; i = get < 1 >( Edge[i] ) ){
			int v = get < 0 >( Edge[i] ) , c = get < 2 > ( Edge[i] );
			long long newy = y + c;
			if( newy < dist[v] ){
				dist[v] = newy;
				pq.push( make_pair( - dist[v] , v ) );
			}
		}
	}
}

int main( int argc , char * argv[] ){
	read( n ) , read( m ) , read( Q );
	memset( head , -1 , sizeof( head ) );
	for(int i = 1 ; i <= m ; ++ i){
		int u , v , c;
		read( u ) , read( v ) , read( c );
		Edge[tot] = make_tuple( v , head[u] , c );
		from[tot] = u;
		head[u] = tot ++ ;
	}
	Dijkstra();
	while( Q -- ){
		int tp , x;
		read( tp ) , read( x );
		if( tp == 1 ) printf( "%I64d\n" , dist[x] == inf ? -1 : dist[x] );
		else{
			for(int i = 0 ; i < x ; ++ i){
				int id ; read( id );
				-- id;
				++ get < 2 > ( Edge[id] );
			}
			memset( upd , 0x3f , ( n + 1 ) << 3 );
			que[0].emplace_back( 1 );
			upd[1] = 0;
			for(int i = 0 ; i <= x ; ++ i)
				while( !que[i].empty() ){
					int u = que[i].back(); que[i].pop_back();
					for(int j = head[u] ; ~j ; j = get < 1 > ( Edge[j] ) ){
						int v = get < 0 > ( Edge[j] );
						long long newc = upd[u] + dist[u] + get < 2 > ( Edge[j] ) - dist[v];
						if( newc < upd[v] ){
							upd[v] = newc;
							if( upd[v] <= x ){
								que[upd[v]].emplace_back( v );
							}
						}
					}
				}
			for(int i = 1 ; i <= n ; ++ i) if( upd[i] ^ inf ) dist[i] += upd[i];
		}
	}
	return 0;
}


#include <bits/stdc++.h>

#define fir first
#define sec second
using namespace std;
typedef long long LL;
typedef unsigned long long u64;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}

namespace io{
	const int L = (1 << 18) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(S == T) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int read() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
};

using io :: read;

const int MaxN = 101234;
const LL infL = 1ll << 60;

int n, m, Q;
struct edge {
	int to, nxt, v;
}e[MaxN << 1]; int cnt, lst[MaxN];

void ins(int a, int b, int c) {
	e[++cnt] = (edge) {b, lst[a], c}; lst[a] = cnt;
}

LL dis[MaxN]; int vis[MaxN];
priority_queue<pair<LL, int>, vector<pair<LL, int> >, greater<pair<LL, int> > > q;

void dijkstra(int s) {
	for(int i = 1; i <= n; i++) dis[i] = infL;
	q.push(make_pair(0, s)); dis[s] = 0;
	while(!q.empty()) {
		int c = q.top().sec; q.pop(); if(vis[c]) continue; vis[c] = 1;
		for(int i = lst[c], b; b = e[i].to, i; i = e[i].nxt)
			if(cmin(dis[b], dis[c] + e[i].v))
				q.push(make_pair(dis[b], b));
	}
}

LL ans[MaxN]; vector<int> g[MaxN];

void rebuild(int s) {
	int i, j, k, b, x; LL up = 0;
	for(i = 1; i <= n; i++) ans[i] = infL;
	ans[s] = 0; g[0].push_back(s);
	for(i = 0; i <= up; i++)
		for(j = 0; j < g[i].size(); j++) {
			if(i > ans[x = g[i][j]]) continue;
			for(k = lst[x]; b = e[k].to, k; k = e[k].nxt)
				if(cmin(ans[b], ans[x] + dis[x] + e[k].v - dis[b]))
					if(ans[b] <= n) g[ans[b]].push_back(b), cmax(up, ans[b]);
		}
	for(i = 0; i <= up; i++) g[i].clear();
	for(i = 1; i <= n; i++) if(dis[i] < infL) dis[i] += ans[i];
}

int main() {
	int i, x;
	n = read(); m = read(); Q = read();
	for(i = 1; i <= m; i++) {
		int a = read(), b = read();
		ins(a, b, read());
	}

	dijkstra(1);

	for(i = 1; i <= Q; i++)
		if(read() == 1)
			printf("%lld\n", dis[x = read()] >= infL ? -1 : dis[x]);
		else {
			for(x = read(); x; x--) e[read()].v++;
			rebuild(1);
		}
	return 0;
}


#include <bits/stdc++.h>

#define fir first
#define sec second
using namespace std;
typedef long long LL;
typedef unsigned long long u64;

template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}
int read() {
	int x = 0, f = 1;char ch;
	for(ch = getchar(); !isdigit(ch); ch = getchar())
		if(ch == '-') f = -1;
	for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
	return x * f;
}

const int MaxN = 101234;
const LL infL = 1ll << 60;

int n, m, Q;
struct edge {
	int to, nxt, v;
}e[MaxN << 1]; int cnt, lst[MaxN];

void ins(int a, int b, int c) {
	e[++cnt] = (edge) {b, lst[a], c}; lst[a] = cnt;
}

LL dis[MaxN]; int vis[MaxN];
priority_queue<pair<LL, int>, vector<pair<LL, int> >, greater<pair<LL, int> > > q;

void dijkstra(int s) {
	for(int i = 1; i <= n; i++) dis[i] = infL;
	q.push(make_pair(0, s)); dis[s] = 0;
	while(!q.empty()) {
		int c = q.top().sec; q.pop(); if(vis[c]) continue; vis[c] = 1;
		for(int i = lst[c], b; b = e[i].to, i; i = e[i].nxt)
			if(cmin(dis[b], dis[c] + e[i].v))
				q.push(make_pair(dis[b], b));
	}
}

LL ans[MaxN]; vector<int> g[MaxN];

void rebuild(int s) {
	int i, j, k, b, x; LL up = 0;
	for(i = 1; i <= n; i++) ans[i] = infL;
	ans[s] = 0; g[0].push_back(s);
	for(i = 0; i <= up; i++)
		for(j = 0; j < g[i].size(); j++) {
			if(i > ans[x = g[i][j]]) continue;
			for(k = lst[x]; b = e[k].to, k; k = e[k].nxt)
				if(cmin(ans[b], ans[x] + dis[x] + e[k].v - dis[b]))
					if(ans[b] <= n) g[ans[b]].push_back(b), cmax(up, ans[b]);
		}
	for(i = 0; i <= up; i++) g[i].clear();
	for(i = 1; i <= n; i++) if(dis[i] < infL) dis[i] += ans[i];
}

int main() {
	int i, x;
	n = read(); m = read(); Q = read();
	for(i = 1; i <= m; i++) {
		int a = read(), b = read();
		ins(a, b, read());
	}

	dijkstra(1);

	for(i = 1; i <= Q; i++)
		if(read() == 1)
			printf("%lld\n", dis[x = read()] >= infL ? -1 : dis[x]);
		else {
			for(x = read(); x; x--) e[read()].v++;
			rebuild(1);
		}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second

typedef long long ll;
typedef pair<ll, int> ii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);

const int N = 1e5 + 5;
int n, m, w[N];
vector<ii> g[N];
ll h[N];

void build() {
  memset(h, INF, sizeof h);
  priority_queue<ii, vector<ii>, greater<ii> > pq;

  pq.emplace(0, 1);
  h[1] = 0;

  while(pq.size()) {
    int at = pq.top().se;
    ll d = pq.top().fi;
    pq.pop();

    for(ii it : g[at]) {
      int nxt = it.fi;
      int w = ::w[it.se];

      if(d + w < h[nxt]) {
        h[nxt] = d+w;
        pq.emplace(h[nxt], nxt);
      }
    }
  }
}

int dist[N];
queue<int> q[N];
void update(int Dmax) {
  memset(dist, INF, sizeof dist);

  dist[1] = 0;
  q[0].push(1);

  for(int d = 0; d <= Dmax; d++) {

    while(q[d].size()) {
      int at = q[d].front();
      q[d].pop();

      if(dist[at] < d) {
        continue;
      }

      for(ii it : g[at]) {
        int nxt = it.fi;
        ll w = h[at] - h[nxt] + ::w[it.se];

        ll D = w+d;

        //cout << d << " " << at << " " << nxt << " " << D << endl;

        if(D <= Dmax and D < dist[nxt]) {
          dist[nxt] = D;
          q[D].push(nxt);
        }
      }
    }

  }

  for(int i = 1; i <= n; i++) {
    //cout << i << " " << h[i] << " " << dist[i] << endl;
    if(h[i] != h[0])
      h[i] += dist[i];
  }
/*
  cout << endl;
  cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
  cout << endl;*/
}

int main (void) {
  int q;
  scanf("%d %d %d", &n, &m, &q);

  for(int i = 1; i <= m; i++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    g[u].eb(v, i);
    ::w[i] = w;
  }

  build();

  while(q--) {
    int op; scanf("%d", &op);

    if(op == 1) {
      int v;  scanf("%d", &v);
      printf("%lld\n", h[v] < h[0] ? h[v] : -1);
    } else {
      int c;  scanf("%d", &c);
      for(int i = 0; i < c; i++) {
        int l;  scanf("%d", &l);
        w[l]++;
      }
      update(c);
    }
  }

	return 0;
}


/************************************************
 * Au: Hany01
 * Date: Aug 22nd, 2018
 * Prob: CF843D
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
#define rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define x first
#define y second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define INF (0x3f3f3f3f3f3f3f3fll)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

inline int read() {
	static int _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

const int maxn = 1e5 + 5;

int n, m, qs, e, v[maxn], beg[maxn], nex[maxn], w[maxn], f[maxn];
LL  dis[maxn];
queue<int> q[maxn];

inline void add(int uu, int vv, int ww) { v[++ e] = vv, w[e] = ww, nex[e] = beg[uu], beg[uu] = e; }

inline void Dijkstra() {
	static priority_queue<PII, vector<PII>, greater<PII> > q;
	static int vis[maxn];
	Set(dis, 63), q.push(mp(0, 1)), dis[1] = 0;
	while (!q.empty()) {
		register int u = q.top().y; q.pop();
		if (vis[u]) continue; else vis[u] = 1;
		for (register int i = beg[u]; i; i = nex[i])
			if (chkmin(dis[v[i]], dis[u] + w[i]))
				q.push(mp(dis[v[i]], v[i]));
	}
}

int main()
{
#ifdef hany01
	freopen("cf843d.in", "r", stdin);
	freopen("cf843d.out", "w", stdout);
#endif

	static int ty, x, uu, vv, ww, lmt;

	n = read(), m = read(), qs = read();
	For(i, 1, m) uu = read(), vv = read(), ww = read(), add(uu, vv, ww);
	Dijkstra();

	while (qs --) {
		ty = read(), x = read();
		if (ty == 1) {
			if (dis[x] < INF) printf("%I64d\n", dis[x]); else puts("-1");
		} else {
			For(i, 1, x) ++ w[read()];
			q[0].push(1), Set(f, 63), f[1] = 0, lmt = 0;
			for (int i = 0; i <= lmt; ++ i)
				while (!q[i].empty()) {
					register int u = q[i].front(), t; q[i].pop();
					if (f[u] < i) continue;
					for (register int j = beg[u]; j; j = nex[j])
						if (chkmin(f[v[j]], t = f[u] - dis[v[j]] + dis[u] + w[j]))
							if (t <= min(x, n)) q[t].push(v[j]), chkmax(lmt, t);
				}
			For(i, 2, n) dis[i] = min(INF, dis[i] + f[i]);
		}
	}

	return 0;
}


/************************************************
 * Au: Hany01
 * Date: Aug 22nd, 2018
 * Prob: CF843D
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef pair<LL, int> PII;
#define rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define x first
#define y second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define INF (0x3f3f3f3f3f3f3f3fll)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 wozenmezhemecaia

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }

inline int read() {
	static int _, __; static char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

namespace pb_ds {

    namespace io {
        const int MaxBuff = 1 << 16;
        const int Output = 1 << 22;
        char B[MaxBuff], *S = B, *T = B;
        #define getc() ((S == T) && (T = (S = B) + fread(B, 1, MaxBuff, stdin), S == T) ? 0 : *S++)
        char Out[Output], *iter = Out;
        inline void flush() {
            fwrite(Out, 1, iter - Out, stdout);
            iter = Out;
        }
    }

    template<class Type> inline Type read() {
        using namespace io;
        register char ch; register Type ans = 0; register bool neg = 0;
        while(ch = getc(), (ch < '0' || ch > '9') && ch != '-')     ;
        ch == '-' ? neg = 1 : ans = ch - '0';
        while(ch = getc(), '0' <= ch && ch <= '9') ans = ans * 10 + ch - '0';
        return neg ? -ans : ans;
    }

    template<class Type> inline void write(register Type x, register char ch = '\n') {
        using namespace io;
        if(!x) *iter++ = '0';
        else {
            if(x < 0) *iter++ = '-', x = -x;
            static int s[100]; register int t = 0;
            while(x) s[++t] = x % 10, x /= 10;
            while(t) *iter++ = '0' + s[t--];
        }
        *iter++ = ch;
    }
}
using namespace pb_ds;

const int maxn = 1e5 + 5;

int n, m, qs, e, v[maxn], beg[maxn], nex[maxn], w[maxn], f[maxn];
LL  dis[maxn];
queue<int> q[maxn];

inline void add(int uu, int vv, int ww) { v[++ e] = vv, w[e] = ww, nex[e] = beg[uu], beg[uu] = e; }

inline void Dijkstra() {
	static priority_queue<PII, vector<PII>, greater<PII> > q;
	static int vis[maxn];
	Set(dis, 63), q.push(mp(0, 1)), dis[1] = 0;
	while (!q.empty()) {
		register int u = q.top().y; q.pop();
		if (vis[u]) continue; else vis[u] = 1;
		for (register int i = beg[u]; i; i = nex[i])
			if (chkmin(dis[v[i]], dis[u] + w[i]))
				q.push(mp(dis[v[i]], v[i]));
	}
}

int main()
{
#ifdef hany01
	freopen("cf843d.in", "r", stdin);
	freopen("cf843d.out", "w", stdout);
#endif

	static int ty, x, uu, vv, ww, lmt;

	n = read<int>(), m = read<int>(), qs = read<int>();
	For(i, 1, m) uu = read<int>(), vv = read<int>(), ww = read<int>(), add(uu, vv, ww);
	Dijkstra();

	while (qs --) {
		ty = read<int>(), x = read<int>();
		if (ty == 1) {
			if (dis[x] < INF) printf("%lld\n", dis[x]); else puts("-1");
		} else {
			For(i, 1, x) ++ w[read<int>()];
			q[0].push(1), Set(f, 63), f[1] = 0, lmt = 0;
			for (int i = 0; i <= lmt; ++ i) {
				while (!q[i].empty()) {
					register int u = q[i].front();
					LL t; q[i].pop();
					if (f[u] < i) continue;
					for (register int j = beg[u]; j; j = nex[j]) {
						if (f[v[j]] > (t = (LL)f[u] - dis[v[j]] + dis[u] + w[j])) {
							f[v[j]] = t;
							if (t <= min(x, n - 1)) q[t].push(v[j]), chkmax(lmt, (int)t);
						}
					}
				}
			}
			For(i, 2, n) dis[i] = min(INF, dis[i] + f[i]);
		}
	}

	return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>

using LL = long long ;
const LL inf = 1e18;
const int kN = 100000 + 5;
int n, m, q;
std::vector<int> edges[kN];
LL dist[kN], dw[kN];
int from[kN], to[kN], w[kN];
int label[kN];
std::vector<int> bucket[kN];

int main()
{
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 0; i < m; ++ i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c); a --; b --;
        from[i] = a;
        to[i] = b;
        w[i] = c;
        edges[a].emplace_back(i);
    }
    std::priority_queue<std::pair<LL, int>> pq;
    std::fill(dist + 1, dist + n, inf);
    pq.emplace(0, 0);
    while (!pq.empty()) {
        LL tmp = -pq.top().first;
        int u = pq.top().second;
        pq.pop();
        if (tmp != dist[u]) continue;
        for (int e : edges[u]) {
            if (dist[to[e]] > dist[u] + w[e]) {
                dist[to[e]] = dist[u] + w[e];
                pq.emplace(-dist[to[e]], to[e]);
            }
        }
    }
    for (int i = 0; i < m; ++ i)
        dw[i] = dist[from[i]] + w[i] - dist[to[i]];

    while (q --) {
        int op;
        scanf("%d", &op);
        if (op == 1) {
            int target;
            scanf("%d", &target); -- target;
            printf("%lld\n", dist[target] == inf ? -1 : dist[target]);
        } else {
            int num;
            scanf("%d", &num);
            for (int i = 0; i < num; ++ i) {
                int x;
                scanf("%d", &x); -- x;
                w[x] ++;
                dw[x] ++;
            }
            std::fill(label, label + n, n);
            label[0] = 0;
            bucket[0].emplace_back(0);
            for (int at = 0; at <= n; ++ at) {
                while (!bucket[at].empty()) {
                    int u = bucket[at].back();
                    bucket[at].pop_back();
                    if (label[u] != at) continue;
                    for (int e : edges[u]) {
                        if (label[u] + dw[e] > n) continue;
                        if (label[to[e]] > label[u] + dw[e]) {
                            label[to[e]] = label[u] + dw[e];
                            bucket[label[to[e]]].emplace_back(to[e]);
                        }
                    }
                }
            }
            for (int i = 0; i < n; ++ i) {
                if (dist[i] != inf)
                    dist[i] += label[i];
            }
            for (int i = 0; i < m; ++ i)
                dw[i] = dist[from[i]] + w[i] - dist[to[i]];
        }
    }
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>

using LL = long long ;
const LL inf = 1e18;
const int kN = 100000 + 5;
int n, m, q;
std::vector<int> edges[kN];
LL dist[kN], dw[kN];
int from[kN], to[kN], w[kN];
int label[kN];
std::vector<int> bucket[kN];

int main()
{
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 0; i < m; ++ i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c); a --; b --;
        from[i] = a;
        to[i] = b;
        w[i] = c;
        edges[a].emplace_back(i);
    }
    std::priority_queue<std::pair<LL, int>> pq;
    std::fill(dist + 1, dist + n, inf);
    pq.emplace(0, 0);
    while (!pq.empty()) {
        LL tmp = -pq.top().first;
        int u = pq.top().second;
        pq.pop();
        if (tmp != dist[u]) continue;
        for (int e : edges[u]) {
            if (dist[to[e]] > dist[u] + w[e]) {
                dist[to[e]] = dist[u] + w[e];
                pq.emplace(-dist[to[e]], to[e]);
            }
        }
    }
    for (int i = 0; i < m; ++ i)
        dw[i] = dist[from[i]] + w[i] - dist[to[i]];

    while (q --) {
        int op;
        scanf("%d", &op);
        if (op == 1) {
            int target;
            scanf("%d", &target); -- target;
            printf("%lld\n", dist[target] == inf ? -1 : dist[target]);
        } else {
            int num;
            scanf("%d", &num);
            for (int i = 0; i < num; ++ i) {
                int x;
                scanf("%d", &x); -- x;
                w[x] ++;
                dw[x] ++;
            }
            std::fill(label, label + n, n);
            label[0] = 0;
            bucket[0].emplace_back(0);
            for (int at = 0; at <= n; ++ at) {
                while (!bucket[at].empty()) {
                    int u = bucket[at].back();
                    bucket[at].pop_back();
                    if (label[u] != at) continue;
                    for (int e : edges[u]) {
                        if (label[u] + dw[e] > n) continue;
                        if (label[to[e]] > label[u] + dw[e]) {
                            label[to[e]] = label[u] + dw[e];
                            bucket[label[to[e]]].emplace_back(to[e]);
                        }
                    }
                }
            }
            for (int i = 0; i < n; ++ i)
                dist[i] += label[i];
            for (int i = 0; i < m; ++ i)
                dw[i] = dist[from[i]] + w[i] - dist[to[i]];
        }
    }
}


#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>

using LL = long long ;
const LL inf = 1e18;
const int kN = 100000 + 5;
int n, m, q;
std::vector<int> edges[kN];
LL dist[kN], dw[kN];
int from[kN], to[kN], w[kN];
int label[kN];
std::vector<int> bucket[kN];

int main()
{
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 0; i < m; ++ i) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c); a --; b --;
        from[i] = a;
        to[i] = b;
        w[i] = c;
        edges[a].emplace_back(i);
    }
    std::priority_queue<std::pair<LL, int>> pq;
    std::fill(dist + 1, dist + n, inf);
    pq.emplace(0, 0);
    while (!pq.empty()) {
        LL tmp = -pq.top().first;
        int u = pq.top().second;
        pq.pop();
        if (tmp != dist[u]) continue;
        for (int e : edges[u]) {
            if (dist[to[e]] > dist[u] + w[e]) {
                dist[to[e]] = dist[u] + w[e];
                pq.emplace(-dist[to[e]], to[e]);
            }
        }
    }
    for (int i = 0; i < m; ++ i)
        dw[i] = dist[from[i]] + w[i] - dist[to[i]];

    while (q --) {
        int op;
        scanf("%d", &op);
        if (op == 1) {
            int target;
            scanf("%d", &target); -- target;
            printf("%lld\n", dist[target] == inf ? -1 : dist[target]);
        } else {
            int num;
            scanf("%d", &num);
            for (int i = 0; i < num; ++ i) {
                int x;
                scanf("%d", &x); -- x;
                w[x] ++;
                dw[x] ++;
            }
            std::fill(label, label + n, num);
            label[0] = 0;
            bucket[0].emplace_back(0);
            for (int at = 0; at <= num; ++ at) {
                while (!bucket[at].empty()) {
                    int u = bucket[at].back();
                    bucket[at].pop_back();
                    if (label[u] != at) continue;
                    for (int e : edges[u]) {
                        if (label[u] + dw[e] > n) continue;
                        if (label[to[e]] > label[u] + dw[e]) {
                            label[to[e]] = label[u] + dw[e];
                            bucket[label[to[e]]].emplace_back(to[e]);
                        }
                    }
                }
            }
            for (int i = 0; i < n; ++ i) {
                if (dist[i] != inf)
                    dist[i] += label[i];
            }
            for (int i = 0; i < m; ++ i)
                dw[i] = dist[from[i]] + w[i] - dist[to[i]];
        }
    }
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
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]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;
const LL 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;
}

LL dist[100111];
void dijkstra(int s)
{
	memset(dist, -1, sizeof(dist));
	priority_queue<pair<LL, int> >q;
	q.push(mp(0, s)); dist[s] = 0;
	while (!q.empty())
	{
		int x = q.top().ss; LL d = -q.top().ff; 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(mp(-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].pb(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]]].pb(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)puts("-1");
			else
			{
				update(1);
				cout << dist[x] << endl;
			}
		}
		else
		{
			sum += x;
			while (x--)
			{
				cin >> y;
				cost[y]++;
			}
		}
	}
	return 0;
}


#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
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]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;
const LL 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;
}

LL dist[100111];
void dijkstra(int s)
{
	memset(dist, -1, sizeof(dist));
	priority_queue<pair<LL, int> >q;
	q.push(mp(0, s)); dist[s] = 0;
	while (!q.empty())
	{
		int x = q.top().ss; LL d = -q.top().ff; 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(mp(-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].pb(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]]].pb(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;
}


#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

typedef pair<long long, int> Plli;

const long long INF = 0x3f3f3f3f3f3f3f3f;

int read()
{
	int u = 0;
	bool f = false;
	char ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-')
			f = true;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		u = u * 10 + ch - '0';
		ch = getchar();
	}
	return f ? -u : u;
}

struct Edge
{
	int to;
	int w;
	int next;
};

int cnt = 0;
Edge e[100001];
int head[100001];

void add(int u, int v, int w)
{
	cnt++;
	e[cnt].to = v;
	e[cnt].w = w;
	e[cnt].next = head[u];
	head[u] = cnt;
}

long long dis[100001];
bool vis[100001];
int n, m, q;

void dijkstra(int q)
{
	memset(vis, 0, sizeof(vis));
	memset(dis, 0x3f, sizeof(dis));
	dis[q] = 0;
	priority_queue<Plli, vector<Plli>, greater<Plli> > pq;
	pq.push(make_pair(0, q));
	while(!pq.empty())
	{
		int u = pq.top().second;
		pq.pop();
		if(vis[u])
			continue;
		vis[u] = true;
		for(int i = head[u]; i != 0; i = e[i].next)
		{
			int v = e[i].to;
			if(dis[v] > dis[u] + e[i].w)
			{
				dis[v] = dis[u] + e[i].w;
				pq.push(make_pair(dis[v], v));
			}
		}
	}
}

queue<int> qs[100001];
long long f[100001];

void bfs(int w)
{
	long long mx = 0;
	for(int i = 0; i <= mx; i++)
	{
		while(!qs[i].empty())
		{
			int u = qs[i].front();
			qs[i].pop();
			if(f[u] < i)
				continue;
			for(int i = head[u]; i != 0; i = e[i].next)
			{
				int v = e[i].to;
				int z = dis[u] + e[i].w - dis[v];
				if(f[v] > f[u] + z)
				{
					f[v] = f[u] + z;
					if(f[v] <= min(w, n - 1))
					{
						qs[f[v]].push(v);
						mx = max((long long)(mx), f[v]);
					}
				}
			}
		}
	}
}

int main()
{
	n = read();
	m = read();
	q = read();
	for(int i = 1; i <= m; i++)
	{
		int u = read();
		int v = read();
		int w = read();
		add(u, v, w);
	}
	dijkstra(1);
	while(q--)
	{
		int opt = read();
		int v = read();
		if(opt == 1)
		{
			if(dis[v] == INF)
				printf("%d\n", -1);
			else
				printf("%lld\n", dis[v]);
		}
		else
		{
			for(int i = 1; i <= v; i++)
			{
				int x = read();
				e[x].w++;
			}
			memset(f, 0x3f, sizeof(f));
			f[1] = 0;
			qs[0].push(1);
			bfs(v);
			for(int i = 1; i <= n; i++)
				dis[i] = min(INF, f[i] + dis[i]);
		}
	}
	return 0;
}


#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int inf = INT_MAX;
const LL INF = LLONG_MAX;

template <typename T> inline int chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + (ch - '0');
	return sum * fl;
}

const int maxn = 1e5 + 5;

int N, M, Qc, c;
int he[maxn], ne[maxn << 1], to[maxn << 1], w[maxn << 1];

inline void add_edge (int x, int y, int z)
{
	ne[++c] = he[x]; he[x] = c; to[c] = y; w[c] = z;
}

LL dis[maxn];

inline void init ()
{
	typedef pair <LL, int> pli;
	priority_queue <pli, vector <pli>, greater <pli> > Q;

	for (int i = 1; i <= N; ++i) dis[i] = LLONG_MAX;
	Q.push (mp (0, 1)); dis[1] = 0;

	while (!Q.empty ())
	{
		LL d = Q.top ().x; int p = Q.top ().y; Q.pop ();
		if (dis[p] != d) continue;

		for (int i = he[p]; i; i = ne[i])
		{
			int y = to[i];
			if (chkmin (dis[y], dis[p] + w[i])) Q.push (mp (dis[y], y));
		}
	}
}

queue <int> Q[maxn];
bool vis[maxn];

inline void update ()
{
	for (int i = 1; i <= N; ++i) vis[i] = 0;
	Q[0].push (1);

	for (int d = 0; d <= N - 1; ++d)
	{
		while (!Q[d].empty ())
		{
			int p = Q[d].front (); Q[d].pop ();
			if (vis[p]) continue;

			vis[p] = 1; dis[p] += d;

			for (int i = he[p]; i; i = ne[i])
			{
				int y = to[i];
				if (dis[p] + w[i] - dis[y] <= N - 1)
					Q[(dis[p] + w[i]) - dis[y]].push (y);
			}
		}
	}
}

int tmp[maxn];

inline void solve ()
{
	init ();

	for (int t = 1; t <= Qc; ++t)
	{
		int opt = read<int>();
		if (opt == 2)
		{
			int cnt = read<int>();
			for (int i = 1; i <= cnt; ++i) ++w[read<int>()];
			update ();
		}
		else
		{
			int x = read<int>();
			if (dis[x] == LLONG_MAX) printf ("-1\n");
			else printf ("%lld\n", dis[x]);
		}
	}
}

inline void input ()
{
	N = read<int>(), M = read<int>(), Qc = read<int>();
	for (int i = 1; i <= M; ++i)
	{
		int x = read<int>(), y = read<int>(), z = read<int>();
		add_edge (x, y, z);
	}
}

int main ()
{

	input ();
    solve ();

    return 0;
}


//#include<bits/stdc++.h>
//
//using namespace std;
//
//const long long INF = 0x3f3f3f3f3f3f3f3f;
//
//struct Edge
//{
//	int dst;
//	int to;
//};
//
//struct Node
//{
//	long long dst;
//	int num;
//};
//
//bool operator < (const Node &a, const Node &b){
//	return a.dst > b.dst;
//}
//vector<Edge> G[1000010];
//
//void add(int u, int v, int w)
//{
//	G[u].push_back((Edge){w, v});
//}
//
//long long dst[100001];
//bool vis[100001];
//int n, m, q;
//
//void DJ(int q)
//{
//	memset(vis, 0, sizeof(vis));
//	memset(dst, 0x3f, sizeof(dst));
//	dst[q] = 0;
//	priority_queue<Node> Q;
//	Q.push((Node){0, q});
//	while(!Q.empty())
//	{
//		Node u = Q.top();
//		Q.pop();
//		if(vis[u.num])
//			continue;
//		vis[u.num] = true;
//		for(int i = 0; i < G[u.num].size();++i)
//		{
//			int v = G[u.num][i].to;
//			long long w = G[u.num][i].dst;
//			if(dst[v] > dst[u.num] + w)
//			{
//				dst[v] = dst[u.num] + w;
//				Q.push((Node){dst[v], v});
//			}
//		}
//	}
//}
//
//queue<int> Q[100001];
//long long f[100001];
//
//void bfs(int w)
//{
//	long long mx = 0;
//	for(int i = 0; i <= mx; i++)
//	{
//		while(!Q[i].empty())
//		{
//			int u = Q[i].front();
//			Q[i].pop();
//			if(f[u] < i)
//				continue;
//			for(int i = 0; i < G[u].size(); ++i)
//			{
//				int v = G[u][i].to;
//				int z = dst[u] + G[u][i].dst - dst[v];
//				if(f[v] > f[u] + z)
//				{
//					f[v] = f[u] + z;
//					if(f[v] <= min(w, n - 1))
//					{
//						Q[f[v]].push(v);
//						mx = max((long long)(mx), f[v]);
//					}
//				}
//			}
//		}
//	}
//}
//
//int main()
//{
//	cin>>n>>m>>q;
//	for(int i = 1; i <= m; i++)
//	{
//		int u, v, w;
//		cin>>u>>v>>w;
//		add(u, v, w);
//	}
//	DJ(1);
//	while(q--)
//	{
//		int opt, v;
//		cin>>opt>>v;
//		if(opt == 1)
//		{
//			if(dst[v] == INF)
//				printf("%d\n", -1);
//			else
//				printf("%lld\n", dst[v]);
//		}
//		else
//		{
//			for(int i = 1; i <= v; i++)
//			{
//				int x;
//				cin>>x;
//				G[i][x].dst++;
//			}
//			memset(f, 0x3f, sizeof(f));
//			f[1] = 0;
//			Q[0].push(1);
//			bfs(v);
//			for(int i = 1; i <= n; i++)
//				dst[i] = min(INF, f[i] + dst[i]);
//		}
//	}
//	return 0;
//}

#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

typedef pair<long long, int> Plli;

const long long INF = 0x3f3f3f3f3f3f3f3f;

int read()
{
	int u = 0;
	bool f = false;
	char ch = getchar();
	while(ch < '0' || ch > '9')
	{
		if(ch == '-')
			f = true;
		ch = getchar();
	}
	while(ch >= '0' && ch <= '9')
	{
		u = u * 10 + ch - '0';
		ch = getchar();
	}
	return f ? -u : u;
}

struct Edge
{
	int to;
	int w;
	int next;
};

int cnt = 0;
Edge e[100001];
int head[100001];

void add(int u, int v, int w)
{
	cnt++;
	e[cnt].to = v;
	e[cnt].w = w;
	e[cnt].next = head[u];
	head[u] = cnt;
}

long long dst[100001];
bool vis[100001];
int n, m, q;

void DJ(int q)
{
	memset(vis, 0, sizeof(vis));
	memset(dst, 0x3f, sizeof(dst));
	dst[q] = 0;
	priority_queue<Plli, vector<Plli>, greater<Plli> > Q1;
	Q1.push(make_pair(0, q));
	while(!Q1.empty())
	{
		int u = Q1.top().second;
		Q1.pop();
		if(vis[u])
			continue;
		vis[u] = true;
		for(int i = head[u]; i != 0; i = e[i].next)
		{
			int v = e[i].to;
			if(dst[v] > dst[u] + e[i].w)
			{
				dst[v] = dst[u] + e[i].w;
				Q1.push(make_pair(dst[v], v));
			}
		}
	}
}

queue<int> Q[100001];
long long f[100001];

void bfs(int w)
{
	long long mx = 0;
	for(int i = 0; i <= mx; i++)
	{
		while(!Q[i].empty())
		{
			int u = Q[i].front();
			Q[i].pop();
			if(f[u] < i)
				continue;
			for(int i = head[u]; i != 0; i = e[i].next)
			{
				int v = e[i].to;
				int z = dst[u] + e[i].w - dst[v];
				if(f[v] > f[u] + z)
				{
					f[v] = f[u] + z;
					if(f[v] <= min(w, n - 1))
					{
						Q[f[v]].push(v);
						mx = max((long long)(mx), f[v]);
					}
				}
			}
		}
	}
}

int main()
{
	n = read();
	m = read();
	q = read();
	for(int i = 1; i <= m; i++)
	{
		int u, v, w;
		cin>>u>>v>>w;
		add(u, v, w);
	}
	DJ(1);
	while(q--)
	{
		int opt, v;
		cin>>opt>>v;
		if(opt == 1)
		{
			if(dst[v] == INF)
				printf("%d\n", -1);
			else
				printf("%lld\n", dst[v]);
		}
		else
		{
			for(int i = 1; i <= v; i++)
			{
				int x = read();
				e[x].w++;
			}
			memset(f, 0x3f, sizeof(f));
			f[1] = 0;
			Q[0].push(1);
			bfs(v);
			for(int i = 1; i <= n; i++)
				dst[i] = min(INF, f[i] + dst[i]);
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define cs const
#define fr first
#define se second
//#define ls (now<<1)
//#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define Mid ((l + r) / 2)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 1e6 + 1;
cs ll inf = 1e17 + 1;
cs int M = 1e9 + 7;
cs double eps = 1e-7;
cs int mod = 998244353;
inline int read() { int x; scanf("%lld", &x); return x; }

int fir[ff], nex[ff], to[ff], tot;
ll va[ff], va2[ff];
void add(int x, int y, ll z) { nex[++tot] = fir[x]; fir[x] = tot; to[tot] = y; va[tot] = z; }
void ade(int x, int y, ll z) { add(x, y, z); add(y, x, z); }

int id[ff];
queue<int> Q[100006];

ll N;
int n, m, q;
struct Node
{
	int vis[ff];
	ll dis[ff], f[ff];
	void solve2()
	{
		rep(i, 1, n) f[i] = inf, vis[i] = 0;
		Q[0].push(1); f[1] = 0;
		rep(i, 0, N)
			while(!Q[i].empty())
			{
				int u = Q[i].front(); Q[i].pop();
				if(vis[u]) continue;
				vis[u] = 1;
				fore(j, u)
				{
					int v = to[j];
					ll w = dis[u] - dis[v] + va[j] + va2[j];
					if(f[u] + w < f[v] && f[u] + w <= N)
						f[v] = f[u] + w, Q[f[v]].push(v);
				}
			}
		rep(i, 1, n) dis[i] = min(inf, f[i] + dis[i]), f[i] = inf;
	}
	void solve()
	{
		priority_queue<pair<int, int> > qs;
		rep(i, 1, n) dis[i] = inf, vis[i] = 0;
		dis[1] = 0; qs.push(mp(0, 1));
		while(!qs.empty())
		{
			int u = qs.top().se; qs.pop();
			if(vis[u]) continue;
			vis[u] = 1;
			fore(i, u)
				if(dis[to[i]] > dis[u] + va[i])
					dis[to[i]] = dis[u] + va[i], qs.push(mp(-dis[to[i]], to[i]));
		}
	}
}dij;

void init()
{
	cin >> n >> m >> q;
	N = n; int u, v; ll w;
	rep(i, 1, m) scanf("%d %d %lld", &u, &v, &w), add(u, v, w), id[i] = tot;
	dij.solve();
	rep(i, 1, q)
	{
		int x, y; scanf("%d %d", &x, &y);
		if(x == 1)
		{
			if(dij.dis[y] >= inf) { puts("-1"); }
			else printf("%lld\n", dij.dis[y]);
			continue;
		}
		rep(j, 1, y)
		{
			int xx; scanf("%d", &xx);
			va2[id[xx]] ++;
		}
		dij.solve2();
	}
}
signed main()
{
	int Ts = 1;
//	cin >> Ts;
	while(Ts--)
		init();
}
/*
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
*/


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const
#define fr first
#define se second
//#define ls (now<<1)
//#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define Mid ((l + r) / 2)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 1e6 + 1;
cs int inf = 1e17 + 1;
cs int M = 1e9 + 7;
cs double eps = 1e-7;
cs int mod = 998244353;
inline int read() { int x; scanf("%lld", &x); return x; }

int fir[ff], nex[ff], to[ff], tot, va[ff], va2[100001];
void add(int x, int y, int z) { nex[++tot] = fir[x]; fir[x] = tot; to[tot] = y; va[tot] = z; }
void ade(int x, int y, int z) { add(x, y, z); add(y, x, z); }

pair<int, int> id[ff];
queue<int> Q[200006];

int N;
int n, m, q;
struct Node
{
	int vis[ff], dis[ff], f[ff];
	void solve2()
	{
		rep(i, 1, n) f[i] = inf, vis[i] = 0;
		Q[0].push(1); f[1] = 0;
		rep(i, 0, N)
			while(!Q[i].empty())
			{
				int u = Q[i].front(); Q[i].pop();
				if(vis[u]) continue;
				vis[u] = 1;
				fore(i, u)
				{
					int v = to[i];
					int w = dis[u] - dis[v] + va[i] + va2[i];
					if(f[u] + w < f[v])
						f[v] = f[u] + w, Q[f[v]].push(v);
				}
			}
		rep(i, 1, n) dis[i] += f[i], f[i] = inf;
	}
	void solve()
	{
		priority_queue<pair<int, int> > qs;
		rep(i, 1, n) dis[i] = inf, vis[i] = 0;
		dis[1] = 0; qs.push(mp(0, 1));
		while(!qs.empty())
		{
			int u = qs.top().se; qs.pop();
			if(vis[u]) continue;
			vis[u] = 1;
			fore(i, u)
				if(dis[to[i]] > dis[u] + va[i])
					dis[to[i]] = dis[u] + va[i], qs.push(mp(-dis[to[i]], to[i]));
		}
	}
}dij;

void init()
{
	cin >> n >> m >> q;
	N = n + n; int u, v, w;
	rep(i, 1, m) scanf("%lld %lld %lld", &u, &v, &w), ade(u, v, w), id[i] = mp(tot - 1, tot);
	dij.solve();
	rep(i, 1, q)
	{
		int x, y; scanf("%lld %lld", &x, &y);
		if(x == 1)
		{
			if(dij.dis[y] >= inf) { puts("-1"); }
			else printf("%lld\n", dij.dis[y] /*+ dij.f[y]*/ );
			continue;
		}
		rep(j, 1, y)
		{
			int xx; scanf("%lld", &xx);
			va2[id[xx].fr] ++; va2[id[xx].se] ++;
		}
		dij.solve2();
	//	cn(va2);
	}
}
signed main()
{
	int Ts = 1;
//	cin >> Ts;
	while(Ts--)
		init();
}
/*
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
*/


#include<cstdio>
#include<queue>

using namespace std;

struct pri
{
	int id;long long val;pri(int i=0,long long v=0):id(i),val(v){}
};bool operator<(pri a,pri b){return a.val>b.val;}

struct e
{
	int to;long long val;e(int t=0,long long v=0):to(t),val(v){}
};vector<e> ed[200000];

bool vis[200000];
const long long INF=1e15;
void Dijsktra(int n,int s,long long *dis)
{
	for(int i=1;i<=n;i++)dis[i]=INF;dis[s]=0;priority_queue<pri> pq;pq.push(pri(s,0));
	for(int i=1;i<=n;i++)vis[i]=0;
	while(!pq.empty())
	{
		pri x=pq.top();pq.pop();
		if(vis[x.id])continue;vis[x.id]=1;int u=x.id;//printf("%d\n",x.id);
		for(int i=0;i<ed[u].size();i++)
		{
			int v=ed[u][i].to;//printf("%d\n",v);
			if(dis[u]+ed[u][i].val<dis[v])
			{
				dis[v]=dis[u]+ed[u][i].val;
				pq.push(pri(v,dis[v]));
			}
		}
	}
}

int u[200000],id[200000];
long long dis[200000];

int n=0,m=0,q=0;
void subtract(long long *dis)
{
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<ed[i].size();j++)
		{
			int u=ed[i][j].to;ed[i][j].val=dis[i]+ed[i][j].val-dis[u];
		}
	}
}

vector<int> v[200000];
void another(int n,int s,long long *dis)
{
	for(int i=1;i<=n;i++)dis[i]=INF;dis[s]=0;v[0].push_back(s);
	for(int i=1;i<=n;i++)vis[i]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<v[i].size();j++)
		{
			int u=v[i][j];if(dis[u]!=i||vis[u])continue;vis[u]=1;
			//puts("???");
			for(int k=0;k<ed[u].size();k++)
			{
				if(dis[u]+ed[u][k].val<n&&dis[u]+ed[u][k].val<dis[ed[u][k].to])
				{
					dis[ed[u][k].to]=dis[u]+ed[u][k].val;
					v[dis[ed[u][k].to]].push_back(ed[u][k].to);
					//puts("???");
				}
			}
		}
	}
	for(int i=0;i<n;i++)v[i].clear();
}

long long dis2[200000];
int main()
{
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&u[i]);id[i]=ed[u[i]].size();
		int v=0,w=0;scanf("%d%d",&v,&w);
		ed[u[i]].push_back(e(v,w));
	}

	/*for(int i=1;i<=n;i++)printf("%lld ",dis[i]);puts("");
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<ed[i].size();j++)printf("%d %d: %d\n",i,ed[i][j].to,ed[i][j].val);
	}*/
	Dijsktra(n,1,dis);subtract(dis);

	while(q--)
	{
		/*for(int i=1;i<=n;i++)
		{
			for(int j=0;j<ed[i].size();j++)printf("%d %d: %d\n",i,ed[i][j].to,ed[i][j].val);
		}*/
		int op=0;scanf("%d",&op);
		if(op==1)
		{
			int x=0;scanf("%d",&x);
			another(n,1,dis2);printf("%lld\n",dis[x]>=INF?-1:dis[x]+dis2[x]);
			//for(int i=1;i<=n;i++)printf("%lld ",dis2[i]);puts("");
			subtract(dis2);for(int i=1;i<=n;i++)dis[i]+=dis2[i];
		}
		else
		{
			int c=0;scanf("%d",&c);
			while(c--)
			{
				int i=0;scanf("%d",&i);ed[u[i]][id[i]].val++;
			}
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<cassert>
using namespace std;
#define ri register int
#define For(i,a,b) for(ri i=(a);i<=(b);++i)
#define DFor(i,a,b) for(ri i=(a);i>=(b);--i)
template<class T>inline T Max(register T a,register T b){return a>b?a:b;}
template<class T>inline T Min(register T a,register T b){return a<b?a:b;}
const int MAXN=100005;const long long INF=0x7ffffffffffffll;
int n,m,Q,tot,h,t,mx;
int head[MAXN];
long long dis[MAXN],f[MAXN];
bool vis[MAXN];
struct edge{int v,w,nxt;}e[MAXN<<1];
struct node{
	int u;long long w;
	friend bool operator <(const node n1,const node n2){return n1.w>n2.w;}
};
template<class T>inline void read(T&x){
 char ch=getchar();x=0;
   while(!isdigit(ch))ch=getchar();
   while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
}
inline void add(int u,int v,int w){++tot;e[tot]=(edge){v,w,head[u]};head[u]=tot;}
priority_queue<node> qn;
inline void dijkstra(){
	For(i,2,n)dis[i]=INF;
	qn.push((node){1,0});dis[1]=0;
	while(!qn.empty()){
		node h=qn.top();qn.pop();
		int u=h.u;if(vis[u])continue;
		vis[u]=1;
		for(ri i=head[u];i;i=e[i].nxt){
			int v=e[i].v;
			if(dis[v]>dis[u]+e[i].w){
				dis[v]=dis[u]+e[i].w;
				qn.push((node){v,dis[v]});
			}
		}
	}
}
queue<int> q[MAXN];
inline void updata(){
	int T=0;
	For(i,1,n)vis[i]=0;
	q[0].push(1);
	For(k,0,mx){
		while(!q[k].empty()){
			int u=q[k].front();q[k].pop();
			if(vis[u])continue;
			vis[u]=1;
			//printf("%d %lld %d\n",u,f[u],k);
			assert(f[u]==k);
			//printf("%d %lld\n",u,f[u]);
			for(ri i=head[u];i;i=e[i].nxt){
				int v=e[i].v,w=e[i].w-dis[v]+dis[u];
				if(!vis[v]){
					f[v]=f[u]+w;
					//printf("#%d->%d %lld\n",u,v,f[v]);
					if(f[v]>mx)continue;
					q[f[v]].push(v);
					T=Max(T,(int)f[v]);
				}
			}
		}
	}
	//For(i,1,n)printf("%lld ",dis[i]);printf("->");
	For(i,1,n)dis[i]+=f[i];
	//For(i,1,n)printf("%lld ",dis[i]);puts("");
}
int main(){
	read(n),read(m),read(Q);//N=n<<1;
	For(i,1,m){
		int u,v,w;read(u),read(v),read(w);
		add(u,v,w);
	}
	dijkstra();
	//For(i,1,n)printf("%lld ",dis[i]);puts("");
	while(Q--){
		int opt,k;read(opt),read(k);
		if(opt==1)printf("%lld\n",dis[k]>=INF?-1ll:dis[k]);
		else {
			int x;
			For(i,1,k)read(x),++e[x].w;
			mx=Min(k,n-1);
			updata();
		}
	}
 return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define inf 10000000000000000ll
using namespace std;
struct node {
	ll v,next,w;
} g[200005];
ll head[200005],cnt;
void add(ll u,ll v,ll w) {
	g[++cnt]=(node) {	v,head[u],w};
	head[u]=cnt;
}
ll n,m,Q;
ll dis[100005];
ll ad[100005];
void dijkstra() {
	priority_queue<pair<ll,ll> >q;
	for(ll i=1; i<=n; i++)	dis[i]=inf;
	q.push(make_pair(0,1));
	dis[1]=0;
	while(!q.empty()) {
		ll u=q.top().second;
		q.pop();
		for(ll i=head[u]; i; i=g[i].next) {
			ll v=g[i].v,w=g[i].w;
			if(dis[v]>dis[u]+w) {
				dis[v]=dis[u]+w;
				q.push(make_pair(-dis[v],v));
			}
		}
	}
}
queue<ll>p[100005];
ll x,y,z,k,cmd;
void new_dijkstra(ll k) {
	ll maxv=0;
	for(ll i=1; i<=n; i++)	ad[i]=inf;
	ad[1]=0;
	p[0].push(1);
	for(ll i=0; i<=maxv; i++) {
		while(!p[i].empty()) {
			ll u=p[i].front();
			p[i].pop();
			if(ad[u]<i)    continue;
			for(ll j=head[u]; j; j=g[j].next) {
				ll v=g[j].v,w=g[j].w;
				ll t=ad[u]+dis[u]-dis[v]+w;
				if(ad[v]>t) {
					ad[v]=t;
					if(t<=min(k,n-1)) {
						p[t].push(v);
						maxv=max(maxv,t);
					}
				}
			}
		}
	}
	for(ll i=1; i<=n; i++)	dis[i]=min(inf,dis[i]+ad[i]);
}
int main() {
	scanf("%lld%lld%lld",&n,&m,&Q);
	for(ll i=1; i<=m; i++) {
		scanf("%lld%lld%lld",&x,&y,&z);
		add(x,y,z);
	}
	dijkstra();
	for(int i=1;i<=Q;i++){
		scanf("%lld",&cmd);
		if(cmd==1) {
			scanf("%lld",&x);
			if(dis[x]>=inf)	puts("-1");
			else printf("%lld\n",dis[x]);
		} else {
			scanf("%lld",&k);
			for(ll i=1; i<=k; i++) {
				scanf("%lld",&x);
				g[x].w++;
			}
			new_dijkstra(k);
		}

	}
}


#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int inf = INT_MAX;
const LL INF = LLONG_MAX;

template <typename T> inline int chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }

template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + (ch - '0');
	return sum * fl;
}

const int maxn = 1e5 + 5;

int N, M, Qc, c;
int he[maxn], ne[maxn << 1], to[maxn << 1], w[maxn << 1];

inline void add_edge (int x, int y, int z)
{
	ne[++c] = he[x]; he[x] = c; to[c] = y; w[c] = z;
}

LL dis[maxn];

inline void init ()
{
	typedef pair <LL, int> pli;
	priority_queue <pli, vector <pli>, greater <pli> > Q;

	for (int i = 1; i <= N; ++i) dis[i] = LLONG_MAX;
	Q.push (mp (0, 1)); dis[1] = 0;

	while (!Q.empty ())
	{
		LL d = Q.top ().x; int p = Q.top ().y; Q.pop ();
		if (dis[p] != d) continue;

		for (int i = he[p]; i; i = ne[i])
		{
			int y = to[i];
			if (chkmin (dis[y], dis[p] + w[i])) Q.push (mp (dis[y], y));
		}
	}
}

queue <int> Q[maxn];
bool vis[maxn];

inline void update ()
{
	for (int i = 1; i <= N; ++i) vis[i] = 0;
	Q[0].push (1);

	for (int d = 0; d <= N - 1; ++d)
	{
		while (!Q[d].empty ())
		{
			int p = Q[d].front (); Q[d].pop ();
			if (vis[p]) continue;

			vis[p] = 1; dis[p] += d;

			for (int i = he[p]; i; i = ne[i])
			{
				int y = to[i];
				Q[(dis[p] + w[i]) - dis[y]].push (y);
			}
		}
	}
}

int tmp[maxn];

inline void solve ()
{
	init ();

	for (int t = 1; t <= Qc; ++t)
	{
		int opt = read<int>();
		if (opt == 2)
		{
			int cnt = read<int>();
			for (int i = 1; i <= cnt; ++i) ++w[read<int>()];
			update ();
		}
		else
		{
			int x = read<int>();
			if (dis[x] == LLONG_MAX) printf ("-1\n");
			else printf ("%lld\n", dis[x]);
		}
	}
}

inline void input ()
{
	N = read<int>(), M = read<int>(), Qc = read<int>();
	for (int i = 1; i <= M; ++i)
	{
		int x = read<int>(), y = read<int>(), z = read<int>();
		add_edge (x, y, z);
	}
}

int main ()
{

	input ();
    solve ();

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#define il inline
#define res register int
#define ll long long
#define pa pair <ll,int>
#define mp make_pair
using namespace std;
const int N=1e5+5;
const int M=1e5+5;
const ll inf=0x3f3f3f3f3f3f3f3f;
il int read()
{
	int x=0,f=0,c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return f?-x:x;
}
struct Edge
{
	int to,next,w;
}e[M];
int head[N],cnt;
il void add(int a,int b,int c)
{
	cnt++;
	e[cnt].to=b;e[cnt].w=c;e[cnt].next=head[a];
	head[a]=cnt;
}
ll d[N];
bool vis[N];
int n,m,q;
ll dij(int s)
{
	priority_queue< pa > q;
	memset(d,0x3f,sizeof d);
	memset(vis,0,sizeof vis);
	d[s]=0; q.push( mp(0,s) );
	while(!q.empty())
	{
		int x=q.top().second; q.pop();
		if(vis[x]) continue;
		vis[x]=1;
		for(res i=head[x];i;i=e[i].next)
		{
			int y=e[i].to;
			if(d[y]>d[x]+e[i].w) d[y]=d[x]+e[i].w, q.push(mp(-d[y],y ));
		}
	}
}
queue<int> s[N];
ll f[N],mx;

void bfs(int c)
{
	mx=0;
	for(res i=0;i<=mx;i++)
		while(!s[i].empty())
		{
			int x=s[i].front(); s[i].pop();
			if(f[x]<i) continue;
			for(res i=head[x];i;i=e[i].next)
			{
				int y=e[i].to,z=d[x]+e[i].w-d[y];
				if(f[y]>f[x]+z)
				{
					f[y]=f[x]+z;
					if(f[y]<=min(c,n-1))
					{
						s[f[y]].push(y);
						mx=max((ll)mx,f[y]);
					}
				}
			}
		}
}

int main()
{
	n=read(); m=read(); q=read();
	for(res i=1;i<=m;i++)
	{
		int x=read(),y=read(),z=read();
		add(x,y,z);
	}
	dij(1);
//	cout<<"dfa:"<<inf<<endl;
	while(q--)
	{
		int opt=read(),c=read();
		if(opt==1) d[c]==inf?puts("-1"):printf("%I64d\n",d[c]);
		else
		{
			for(res i=1;i<=c;i++) e[read()].w++;
			memset(f,0x3f,sizeof f);
			f[1]=0; s[0].push(1);
			bfs(c);
			for(res i=1;i<=n;i++) d[i]=min(d[i],f[i]+d[i]);
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#define INF 10000000000000000ll
#define inf 10000000000000000ll
#define ll long long
#define maxn 100005
using namespace std;
int n,m,q;
long long dis[maxn];
long long ad[maxn];
struct edge {
	int to;
	int next;
	int len;
} E[maxn<<1];
int head[maxn];
int size=0;
void add_edge(int u,int v,int w) {
	size++;
	E[size].to=v;
	E[size].len=w;
	E[size].next=head[u];
	head[u]=size;
}

struct node {
	int x;
	long long d;
	node() {

	}
	node(int u,long long v) {
		x=u;
		d=v;
	}
	friend bool operator <(node u,node v) {
		return u.d>v.d;
	}
};
void dijkstra() {
	priority_queue<pair<ll,ll> >q;
	for(ll i=1; i<=n; i++)	dis[i]=inf;
	q.push(make_pair(0,1));
	dis[1]=0;
	while(!q.empty()) {
		ll u=q.top().second;
		q.pop();
		for(ll i=head[u]; i; i=E[i].next) {
			ll v=E[i].to,w=E[i].len;
			if(dis[v]>dis[u]+w) {
				dis[v]=dis[u]+w;
				q.push(make_pair(-dis[v],v));
			}
		}
	}
}
queue<int>p[maxn];
void new_dijkstra(int k) {
	ll maxv=0;
	for(ll i=1; i<=n; i++)	ad[i]=inf;
	ad[1]=0;
	p[0].push(1);
	for(ll i=0; i<=maxv; i++) {
		while(!p[i].empty()) {
			ll u=p[i].front();
			p[i].pop();
			if(ad[u]<i)    continue;
			for(ll j=head[u]; j; j=E[j].next) {
				ll v=E[j].to,w=E[j].len;
				ll t=ad[u]+dis[u]-dis[v]+w;
				if(ad[v]>t) {
					ad[v]=t;
					if(t<=min(k,n-1)) {
						p[t].push(v);
						maxv=max(maxv,t);
					}
				}
			}
		}
	}
	for(ll i=1; i<=n; i++)	dis[i]=min(inf,dis[i]+ad[i]);
}

int main() {
	int Q,x,y,z;
	scanf("%lld%lld%lld",&n,&m,&Q);
	for(ll i=1; i<=m; i++) {
		scanf("%lld%lld%lld",&x,&y,&z);
		add_edge(x,y,z);
	}
	dijkstra();
	int cmd,k;
	while(Q--) {
		scanf("%lld",&cmd);
		if(cmd==1) {
			scanf("%lld",&x);
			if(dis[x]>=inf)	puts("-1");
			else printf("%lld\n",dis[x]);
		} else {
			scanf("%lld",&k);
			for(ll i=1; i<=k; i++) {
				scanf("%lld",&x);
				E[x].len++;
			}
			new_dijkstra(k);
		}

	}
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define cs const
#define fr first
#define se second
//#define ls (now<<1)
#define rs (now<<1|1)
#define mid ((l+r)>>1)
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define low(i) (i&(-i))
#define par pair<int,int>
#define cn(x) memset(x, 0, sizeof(x))
#define rep(i, x, y) for(int i=x; i<=y; ++i)
#define sep(i, x, y) for(int i=x; i>=y; --i)
#define fore(i, x) for(int i=fir[x]; i; i=nex[i])

cs int G = 3;
cs int ff = 2e6 + 1;
cs int inf = 1e17 + 1;
cs int M = 1e9 + 7;
cs double eps = 1e-7;
inline int read() { int x; scanf("%lld", &x); return x; }

struct DSU
{
	int fa[ff];
	void pre(int N) { rep(i, 1, N) fa[i] = i; }
	int find(int x) { return fa[x] == x? x : fa[x] = find(fa[x]); }
	void merge(int x, int y)
	{
		x = find(x); y = find(y);
		if(x != y) fa[x] = y;
		//x==y?0:fa[x]=y;
	}
}dsu;

int fir[ff], nex[ff], to[ff], tot, va[ff];
void clean() { tot = 0; cn(fir); }
void add(int x, int y, int z)
{
	nex[++tot] = fir[x];
	fir[x] = tot;
	to[tot] = y;
	va[tot] = z;
}
void ade(int x, int y, int z) { add(x, y, z); add(y, x, z); }

int n, m, q, vis[ff], dis[ff];
void dij1()
{
	rep(i, 1, n) dis[i] = inf, vis[i] = 0;
	priority_queue<pair<ll, ll> > q;
	q.push(mp(0, 1)); dis[1] = 0;
	while(!q.empty())
	{
		int u = q.top().se; q.pop();
		if(vis[u]) continue;
		vis[u] = 1;
		fore(i, u)
			if(dis[to[i]] > dis[u] + va[i])
				dis[to[i]] = dis[u] + va[i], q.push(mp(-dis[to[i]], to[i]));
	}
}

pair<ll, ll> id[ff];
int dis2[ff], vis2[ff];
vector<int> tong[ff];
void dij2()
{
	int hd = 0, hd2 = 0;
	rep(i, 1, n) dis2[i] = inf, vis2[i] = 0;
	tong[0].push_back(1); dis2[1] = 0;
	while(hd <= 2000)
	{
		int sz = tong[hd].size(); sz --;
		while(sz < hd2 && hd <= 2000)
			hd ++, hd2 = 0, sz = tong[hd].size(), sz --;

		if(hd > 2000) break;

		int u = tong[hd][hd2]; hd2 ++;
		if(vis2[u]) continue; vis2[u] = 1;
		fore(i, u)
		{
			if(dis2[to[i]] > dis2[u] + va[i])
				dis2[to[i]] = dis2[u] + va[i], tong[dis2[to[i]]].push_back(to[i]);
		}
	}
}

int u[ff], v[ff], w[ff];
void init()
{
	cin >> n >> m >> q;
	rep(i, 1, m)
	{
		scanf("%lld %lld %lld", &u[i], &v[i], &w[i]);
		ade(u[i], v[i], w[i]);
	}
	dij1(); clean();
	rep(i, 1, m)
	{
		ade(u[i], v[i], dis[u[i]] - dis[v[i]] + w[i]);
		id[i] = mp(tot - 1, tot);
	//	cout << "  " << u[i] << " " << v[i] << "\n";
	}
	rep(i, 1, q)
	{
		int x, y, opt; scanf("%lld", &opt);
	//	cout << " " << opt << "\n";
		if(opt == 1)
		{
			dij2(), scanf("%lld", &x);
			if(dis[x] == inf) puts("-1");
			else cout << dis[x] + dis2[x] << "\n";
		}
		else
		{
			scanf("%lld", &y);
			int z;
			rep(j, 1, y) scanf("%lld", &z), va[id[z].fr] ++, va[id[z].se] ++;
		}
	}
}
signed main()
{
//	freopen("xor.in", "r", stdin);
//	freopen("xor.out", "w", stdout);
	int Ts = 1;
	while(Ts--)
		init();
}