#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
//#define EPS 0.000000001
using namespace std;

#define EPS 0.0000001
#define NUM 105

enum Type{
	CATCH_UP,
	ARRIVE_ROOM,
	WATER_UP,
	WATER_DOWN,
	FINISH,
};

enum Water{
	West,
	East,
	Moving,
};

struct Info{
	void set(double arg_loc,double arg_down_time,double arg_up_time,bool arg_is_east_higher){
		loc = arg_loc;
		down_time = arg_down_time;
		up_time = arg_up_time;
		is_east_higher = arg_is_east_higher;
	}
	double loc,down_time,up_time,move_end_time;
	bool is_east_higher;
	int wait_ship_id;
	Water water,next_water;
};

struct Ship{
	void set(double arg_current_loc,int arg_max_speed,int arg_current_speed){
		current_loc = arg_current_loc;
		max_speed = arg_max_speed;
		current_speed = arg_current_speed;
	}
	double current_loc;
	bool is_waiting;
	int last_room,max_speed,current_speed;
};

struct Data{
	Data(){
		event_time = 0;
		ship_id = 0;
		room_id = 0;
		type = CATCH_UP;
	}
	Data(double arg_event_time,int arg_ship_id,int arg_room_id,Type arg_type){
		event_time = arg_event_time;
		ship_id = arg_ship_id;
		room_id = arg_room_id;
		type = arg_type;
	}
	bool operator<(const struct Data &arg) const{
		return event_time > arg.event_time;
	}
	double event_time;
	int ship_id,room_id;
	Type type;
};

int num_room,num_ship;
int debug_array[NUM];
double LENGTH;
Info info[NUM];
Ship ship[NUM];

void set_speed(int ship_head){

	//★前の船との距離がちょうど1kmで、1つ前の航行速度より最大速度が速いなら、1つ前のスピードに合わせる
	for(int i = ship_head+1; i < num_ship; i++){

		if(ship[i].is_waiting)continue; //閘門の中ならSKIP

		if(ship[i-1].current_loc-ship[i].current_loc > 1.0){ //距離が1より大きい

			ship[i].current_speed = ship[i].max_speed;
			continue;
		}

		//距離がちょうど1
		if(ship[i].max_speed > ship[i-1].current_speed){

			ship[i].current_speed = ship[i-1].current_speed;
		}else{

			ship[i].current_speed = ship[i].max_speed;
		}
	}
}

void calc_loc(int ship_head,double add_time){

	for(int i = ship_head; i < num_ship; i++){
		ship[i].current_loc += ship[i].current_speed*add_time;
	}
}

//ある船が、ある閘門に到着するまでの時間を求める
double calc_time(int ship_id,int room_id){

	double dist = info[room_id].loc-ship[ship_id].current_loc;
	return dist/(double)ship[ship_id].current_speed;
}

void func(){

	double X,L,F,D;
	int UD;

	double first_time = BIG_NUM;
	Type first_event = ARRIVE_ROOM;
	int first_ship,first_room;

	//閘門の情報を取得
	for(int i = 0; i < num_room; i++){

		scanf("%lf %lf %lf %lf %d",&X,&L,&F,&D,&UD);
		info[i].set(X,L/D,L/F,UD == 0);

		//シミュレーションの開始時点において、水位は低い方に合っている
		if(info[i].is_east_higher){
			info[i].water = West;
		}else{
			//★★★西側の水位に合わせる★★★
			info[i].water = Moving;
			info[i].next_water = West;
			info[i].move_end_time = info[i].up_time;
			if(first_time > info[i].up_time){
				first_time = info[i].up_time;
				first_event = WATER_UP;
				first_ship = -1;
				first_room = i;
			}
		}
		info[i].wait_ship_id = -1; //★待っている船があれば、そのidを持つ★
	}
	info[num_room].loc = LENGTH; //★時間計算簡易化のため★

	int tmp_speed;

	//船の情報を取得
	for(int i = 0; i < num_ship; i++){

		scanf("%d",&tmp_speed);
		ship[i].set(-1*i,tmp_speed,tmp_speed);
		ship[i].last_room = -1; //最後に通過した閘門のインデックス
		ship[i].is_waiting = false;
		debug_array[i] = 0;
	}

	int tmp_id,next_ship,next_room;
	double ans = BIG_NUM;
	double tmp_time;

	Type next_type;

	//★最初は1km等間隔に並んでいるため、まず船の速度を設定する★
	set_speed(0);

	/*★★船の速度が変化するイベントは、前のものが終わるまで、次のものをpushしない★★*/

	priority_queue<Data> Q;

	if(first_event == ARRIVE_ROOM){

		Q.push(Data(calc_time(0,0),0,0,ARRIVE_ROOM)); //全ての閘門の水位が西に合っているなら、先頭の船のイベントを追加
	}else{

		tmp_time = calc_time(0,0);

		if(tmp_time < first_time){

			Q.push(Data(tmp_time,0,0,ARRIVE_ROOM));
		}else{

			Q.push(Data(first_time,first_ship,first_room,first_event));
		}
	}

	Data data;
	double current_time,pre_time = 0,next_time;
	int ship_head = 0;

	while(true){

		data = Q.top();
		Q.pop();

		current_time = Q.top().event_time;
		//★★船全体を動かす★★
		if(fabs(current_time-pre_time) > EPS){
			calc_loc(0,current_time-pre_time);
		}

		switch(data.type){
		case CATCH_UP: //ある船が別の船の1km後方に到達した場合

			ship[data.ship_id].current_speed = ship[data.ship_id-1].current_speed;
			set_speed(data.ship_id); //影響を後ろに伝播させる

			break;

		case ARRIVE_ROOM: //ある船がある閘門に到達した場合

			//閘門の中ではspeed0とする
			ship[data.ship_id].current_speed = 0;
			ship[data.ship_id].is_waiting = true;
			//自分以降の船に、停止情報を伝える
			set_speed(data.ship_id);

			info[data.room_id].wait_ship_id = data.ship_id; //★とりあえず待つ★

			if(info[data.room_id].water == West){ //水位が西側に合っている場合のみ中に入る

				if(info[data.room_id].is_east_higher){

					info[data.room_id].move_end_time = current_time+info[data.room_id].up_time;
				}else{
					info[data.room_id].move_end_time = current_time+info[data.room_id].down_time;
				}
				info[data.room_id].water = Moving;
				info[data.room_id].next_water = East;
			}

			break;

		case WATER_UP:

			if(info[data.room_id].is_east_higher){ //東の方が水位が高い場合

				//★基本的に閘門の水位は西側に合わせるので、必ず船がいるはず
				tmp_id = info[data.room_id].wait_ship_id;
				ship[tmp_id].last_room = data.room_id; //通過済とする
				ship[tmp_id].is_waiting = false;
				debug_array[tmp_id]++;
				info[data.room_id].wait_ship_id = -1;

				//★閘門を通過した船の速度を設定する
				if(tmp_id == 0){

					ship[tmp_id].current_speed = ship[tmp_id].max_speed;
					set_speed(tmp_id); //影響を伝播させる

				}else{ //自分が先頭でないなら、自分の1つ前から計算すれば良い

					set_speed(tmp_id-1);
				}

				//閘門の水位が動き終わる時刻等を設定
				info[data.room_id].water = Moving;
				info[data.room_id].move_end_time = current_time+info[data.room_id].down_time;
				info[data.room_id].next_water = West;

			}else{ //西側の方が水位が高い場合(★船は中にいないが、手前で待っている場合あり★)

				info[data.room_id].water = West;
				if(info[data.room_id].wait_ship_id != -1){ //水位の変動を待っている船がいる場合

					info[data.room_id].water = Moving;
					info[data.room_id].move_end_time = current_time+info[data.room_id].down_time;
					info[data.room_id].next_water = East;
				}
			}
			break;
		case WATER_DOWN:

			if(info[data.room_id].is_east_higher){ //東の方が水位が高い場合(★船は中にいないが、手前で待っている場合あり★)

				info[data.room_id].water = West;
				if(info[data.room_id].wait_ship_id != -1){ //水位の変動を待っている船がいる場合
					info[data.room_id].water = Moving;
					info[data.room_id].move_end_time = current_time+info[data.room_id].up_time;
					info[data.room_id].next_water = East;
				}

			}else{ //西側の方が水位が高い場合

				//★基本的に閘門の水位は西側に合わせるので、必ず船がいるはず
				tmp_id = info[data.room_id].wait_ship_id;
				ship[tmp_id].last_room = data.room_id; //通過済とする
				ship[tmp_id].is_waiting = false;
				info[data.room_id].wait_ship_id = -1;
				debug_array[tmp_id]++;

				//★閘門を通過した船の速度を設定する:仮に自分が先頭でないなら、自分の1つ前から計算すれば良い★
				if(tmp_id == 0){

					ship[tmp_id].current_speed = ship[tmp_id].max_speed;
					set_speed(tmp_id); //影響を伝播させる

				}else{

					set_speed(tmp_id-1);
				}

				//閘門の水位が動き終わる時刻等を設定
				info[data.room_id].water = Moving;
				info[data.room_id].move_end_time = current_time+info[data.room_id].up_time;
				info[data.room_id].next_water = West;
			}

			break;
		case FINISH: //ある船が川を抜けた場合

			ans = current_time;

			ship_head++;
			break;
		}

		if(ship_head == num_ship)break;

		/*★★★最も早く起こる、次のイベントを計算★★★*/
		next_time = BIG_NUM;

		//船を走査
		for(int i = 0; i < num_ship; i++){

			if(fabs(ship[i].current_speed) < EPS){ //★閘門前、または前が詰まっているために待ち状態ならSKIP

				//★★★ぴったり、閘門の前で止まっている場合あり★★★
				if(fabs(ship[i].current_loc-info[ship[i].last_room+1].loc) < EPS && ship[i].is_waiting == false){

					next_time = current_time; //現在なので必ず最速
					next_ship = i;
					next_room = ship[i].last_room+1;
					next_type = ARRIVE_ROOM;
					break;
				}

			}else{

				//★1つ前の船の1km手前に追いつく時刻
				if(i != 0 && ship[i].current_speed > ship[i-1].current_speed){

					tmp_time = current_time+((ship[i-1].current_loc-ship[i].current_loc)-1.0)/(double)(ship[i].current_speed-ship[i-1].current_speed);

					if(next_time > tmp_time){

						if(fabs(next_time-tmp_time) < EPS){
							next_time = current_time;
							break;
						}else{
							next_time = tmp_time;
						}

						next_ship = i;
						next_room = -1;
						next_type = CATCH_UP;
					}
				}

				if(i < ship_head || fabs(ship[i].current_speed) < EPS)continue;

				//★閘門に到達する時刻
				if(fabs(ship[i].current_loc-info[ship[i].last_room+1].loc) < EPS){

					tmp_time = current_time;

				}else{

					tmp_time = current_time+calc_time(i,ship[i].last_room+1);
				}

				if(ship[i].last_room+1 == num_room){ //次で川を出る場合

					if(next_time > tmp_time){
						next_time = tmp_time;
						next_ship = i;
						next_room = ship[i].last_room+1;
						next_type =  FINISH;
					}

				}else{

					if(next_time > tmp_time){
						next_time = tmp_time;
						next_ship = i;
						next_room = ship[i].last_room+1;
						next_type =  ARRIVE_ROOM;
					}
				}
			}
		}

		//閘門を走査
		for(int i = 0; i < num_room; i++){

			if(info[i].water != Moving)continue;

			if(next_time > info[i].move_end_time){

				next_time = info[i].move_end_time;
				next_room = i;
				next_ship = -1;

				if(info[i].is_east_higher){

					if(info[i].next_water == West){
						next_type = WATER_DOWN;
					}else{
						next_type = WATER_UP;
					}
				}else{ //西の方が水位が高い

					if(info[i].next_water == West){
						next_type = WATER_UP;
					}else{
						next_type = WATER_DOWN;
					}
				}
			}
		}

		Q.push(Data(next_time,next_ship,next_room,next_type));

		pre_time = current_time;
	}

	printf("%.10lf\n",ans);
}

int main(){

	while(true){
		scanf("%d %d %lf",&num_room,&num_ship,&LENGTH);
		if(num_room == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 3176