#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
const int M = 3e4 + 5;
const int INF = 2e9 + 5;
int n, m;
int s, t;
struct road {
  int u, v;
  int w;
  road() {}
  road(int _u, int _v, int _w) {
    u = _u;
    v = _v;
    w = _w;
  }
};
vector<road> edge;
bool vis[N];
vector<int> nb[N];
int disc[N];
int adj(int v, int e) {
  if (v == edge[e].u)
    return edge[e].v;
  else
    return edge[e].u;
}
vector<int> simple_path;
void DFS_simple_path(int v) {
  vis[v] = true;
  for (int i = 0; i < nb[v].size(); i++) {
    if (vis[t]) return;
    int e = nb[v][i];
    int u = adj(v, e);
    if (!vis[u]) {
      simple_path.push_back(e);
      DFS_simple_path(u);
      if (!vis[t]) simple_path.pop_back();
    }
  }
}
int ans = INF;
vector<int> ans_edges;
bool forbid[M];
bool isbridge[M];
vector<int> bt[N];
vector<int> path;
void relax() {
  memset(forbid, false, sizeof(forbid));
  memset(vis, false, sizeof(vis));
  memset(isbridge, false, sizeof(isbridge));
  for (int i = 0; i <= n; i++) bt[i].clear();
  path.clear();
}
void can_reach(int v) {
  vis[v] = true;
  for (int i = 0; i < nb[v].size(); i++) {
    int e = nb[v][i];
    int u = adj(v, e);
    if (forbid[e]) continue;
    if (!vis[u]) can_reach(u);
  }
}
int cur_ans;
int low[N], timer;
void mark_bridges(int v, int le = -1) {
  low[v] = disc[v] = timer++;
  vis[v] = true;
  for (int i = 0; i < nb[v].size(); i++) {
    int e = nb[v][i];
    int u = adj(v, e);
    if (forbid[e]) continue;
    if (!vis[u]) {
      mark_bridges(u, e);
      low[v] = min(low[v], low[u]);
    } else {
      if (e != le) low[v] = min(low[v], disc[u]);
    }
  }
  if (low[v] == disc[v] && le != -1) {
    isbridge[le] = true;
  }
}
int comp[N];
int comps;
void DFS_BridgeTree(int v) {
  vis[v] = true;
  comp[v] = comps;
  queue<int> q;
  q.push(v);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < nb[u].size(); i++) {
      int e = nb[u][i];
      int to = adj(u, e);
      if (vis[to] || forbid[e]) continue;
      if (isbridge[e]) {
        comps++;
        bt[comp[v]].push_back(e);
        bt[comps].push_back(e);
        DFS_BridgeTree(to);
      } else {
        q.push(to);
        vis[to] = true;
        comp[to] = comp[v];
      }
    }
  }
}
int adj_comp(int v, int e) {
  if (comp[edge[e].u] != v)
    return comp[edge[e].u];
  else
    return comp[edge[e].v];
}
void get_path(int v) {
  vis[v] = true;
  for (int i = 0; i < bt[v].size(); i++) {
    if (vis[comp[t]]) return;
    int e = bt[v][i];
    int u = adj_comp(v, e);
    if (!vis[u]) {
      path.push_back(e);
      get_path(u);
      if (!vis[comp[t]]) path.pop_back();
    }
  }
}
void print_bridges(int it) {
  cerr << it << ": ";
  for (int i = 0; i < m; i++) {
    if (isbridge[i]) cerr << i + 1 << " ";
  }
  cerr << endl;
}
int main() {
  int i;
  int u, v, w;
  scanf("%d%d", &n, &m);
  scanf("%d%d", &s, &t);
  for (i = 1; i <= m; i++) {
    scanf("%d%d%d", &u, &v, &w);
    nb[u].push_back((int)edge.size());
    nb[v].push_back((int)edge.size());
    edge.push_back(road(u, v, w));
  }
  DFS_simple_path(s);
  if (!vis[t]) {
    printf("0\n");
    printf("0\n");
    return 0;
  }
  for (i = 0; i < simple_path.size(); i++) {
    relax();
    forbid[simple_path[i]] = true;
    can_reach(s);
    if (!vis[t]) {
      if (edge[simple_path[i]].w < ans) {
        ans = edge[simple_path[i]].w;
        ans_edges.clear();
        ans_edges.push_back(simple_path[i]);
      }
      continue;
    }
    timer = 0;
    memset(vis, false, sizeof(vis));
    mark_bridges(s);
    memset(vis, false, sizeof(vis));
    comps = 1;
    DFS_BridgeTree(s);
    if (comp[s] == comp[t]) continue;
    memset(vis, false, sizeof(vis));
    get_path(comp[s]);
    for (int j = 0; j < path.size(); j++) {
      int cur_ans = edge[simple_path[i]].w + edge[path[j]].w;
      if (cur_ans < ans) {
        ans = cur_ans;
        ans_edges.clear();
        ans_edges.push_back(simple_path[i]);
        ans_edges.push_back(path[j]);
      }
    }
  }
  if (ans == INF) {
    printf("-1\n");
  } else {
    printf("%d\n", ans);
    printf("%d\n", (int)ans_edges.size());
    for (i = 0; i < ans_edges.size(); i++) {
      printf("%d ", ans_edges[i] + 1);
    }
    printf("\n");
  }
  return 0;
}
