#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef long long ll;

const int MAX_SIZE = 10000;

struct edge{
	int to;
	int cost;
	int kipKind;
};

// ツノツーツドツづ個暗環置
vector<edge> G[101][11];
int d[101][11];
const int INF = 1000000000;


class Situation{
public:
	Situation(double _cost,int _node,int _used){
		cost = _cost;
		node = _node;
		used = _used;
	}

	Situation();

	double cost;
	int node;
	int used;

	bool operator<(const Situation &sit)const{
		return sit.cost < (this->cost);
	}
};

void dijkstra(int s,int g,int c){
	priority_queue<Situation> que;

	for(int i = 0; i < 101; i++)
		fill(d[i],d[i]+11,INF);
	d[s][c] = 0;

	que.push(Situation(0,s,c));
	while(!que.empty()){
		Situation p = que.top();
		que.pop();
		int v = p.node;
		int used = p.used;
		if(d[v][used] < p.cost)
			continue;
		for(int i = 0; i < G[v][used].size(); i++){
			edge e = G[v][used][i];
			if(d[e.to][e.kipKind] > d[v][used]+e.cost){
				d[e.to][e.kipKind] = d[v][used]+e.cost;
				que.push(Situation(d[e.to][e.kipKind],e.to,e.kipKind));
			}
		}

	}
	

	int minCost = INF;

	for(int i = 0; i <= c; i++){
		minCost = min(minCost,d[g][i]);
	}
	if(minCost != INF)
		cout << minCost << endl;
	else
		cout << "Impossible" << endl;
}



int main(){

	int n,m,s,d,c;
	while(cin>>c>>n>>m>>s>>d&&!(c==0&&n==0&&m==0&&s==0&&d==0)){
		s--;
		d--;
		for(int i = 0; i < m; i++){
			int from,to,cost;
			cin>>from>>to>>cost;
			from--;
			to--;
			for(int j = 0; j <= c; j++){
				if(j-1>=0){
					edge e;
					e.cost=cost/2;
					e.to=to;
					e.kipKind=j-1;
					G[from][j].push_back(e);
					e.to=from;
					G[to][j].push_back(e);
				}
				edge e;
				e.cost=cost;
				e.to=to;
				e.kipKind=j;
				G[from][j].push_back(e);
				e.to=from;
				G[to][j].push_back(e);
			}
		}
		dijkstra(s,d,c);
		for(int i = 0; i < 101; i++)
			for(int j = 0; j < 11; j++)
				G[i][j].clear();
		//cout<<endl;
	}


	return 0;
}