#define min(a,b)((a)<(b)?(a):(b))
#define inf 0x01010101
N;//¬ºÌ
Edge[2][201][201];//[¤H0,CH1][¬º][¬º]
Cost[201][201];//[¡³ñÌÊu][DÌÊu]:=ÅZÚ®Ô
Done[201][201];//[¡³ñÌÊu][DÌÊu]:=ètO
Dijkstra(int*C,int start,int dest){
	int boat,rito,boatmin,ritomin,c,cmin;
	memset(Done,0,sizeof(Done));
	memset(Cost,1,sizeof(Cost));//inf
	memcpy(Cost+start,C,sizeof(int)*201);//startÊuÅÌóÔ
	for(;;){
		//¢èÌóÔÌàAÅZÌàÌðIð
		cmin=inf;
		for(rito=1;rito<=N;rito++){
			for(boat=1;boat<=N;boat++){
				if(!Done[rito][boat]&&Cost[rito][boat]<cmin){
					ritomin=rito;
					boatmin=boat;
					cmin=Cost[rito][boat];
				}
			}
		}
		if(cmin==inf)
			break;
		//»êðèÆ·é
		Done[ritomin][boatmin]=1;
		//×ÚóÔðXV
		for(rito=1;rito<=N;rito++){
			//¤H
			c=Cost[ritomin][boatmin]+Edge[0][ritomin][rito];
			if(c<Cost[rito][boatmin]){
				Cost[rito][boatmin]=c;
			}
			//»±ÉDª êÎCH
			if(ritomin==boatmin){
				c=Cost[ritomin][boatmin]+Edge[1][ritomin][rito];
				if(c<Cost[rito][rito]){
					Cost[rito][rito]=c;
				}
			}
		}
	}
	memcpy(C,Cost+dest,sizeof(int)*201);//destÊuÅÌóÔ
}
main(){
	int M,R,z;
	int C[201];//[DÌÊu]:=ÅZÚ®Ô
	for(;scanf("%d%d",&N,&M)*N;){
		memset(Edge,1,sizeof(Edge));//inf
		for(;M--;){
			int x,y,t,s;
			char sl[2];
			scanf("%d%d%d%s",&x,&y,&t,sl);
			s=sl[0]=='L'?0:1;
			Edge[s][x][y]=min(Edge[s][x][y],t);
			Edge[s][y][x]=min(Edge[s][y][x],t);
		}
		scanf("%d%d",&R,&z);
		memset(C,1,sizeof(C));//inf
		C[z]=0;
		for(;--R;){
			int Z;
			scanf("%d",&Z);
			Dijkstra(C,z,Z);
			z=Z;
		}
		{
			int c=1<<20;
			for(z=1;z<=N;z++)
				c=min(c,C[z]);
			printf("%d \n",c);
		}
	}
}