#include "minecraft.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <cmath>
using namespace std;

static const string password = "8d5d806ee0638f32a96dca2edb207f55d0a209a8b58b4b98b5174f6e3113e474";

static const int maxn = 1e5 + 7;
static vector<int> portal;
static vector<pair<int, pair<int, int>>> g;
static vector<int> fortress;
static int n, k, m, f, l, x, y, L;
static int pref[maxn];
static int q1 = 0, q3 = 0;
int find_portals(int l, int r)
{
    q1++;
    if(l<1||r>n||l>r) {
        q1=1e9;
        return 0;
    }
    return pref[r] - pref[l - 1];
}
string throw_eye(pair<int, int> coordinates)
{
    q3++;
    int x2 = coordinates.first;
    int y2 = coordinates.second;
    if(x2>L||x2<1||y2>L||y2<1) {
        q3=1e9;
    }
    if (x2 == x && y2 == y)
    {
        return "NONE";
    }
    if (x2 > x)
    {
        if (y2 > y)
        {
            return "SW";
        }
        if (y2 == y)
        {
            return "W";
        }
        if (y2 < y)
        {
            return "NW";
        }
    }
    if (x2 == x)
    {
        if (y2 > y)
        {
            return "S";
        }
        else
        {
            return "N";
        }
    }
    if (x2 < x)
    {
        if (y2 > y)
        {
            return "SE";
        }
        if (y2 == y)
        {
            return "E";
        }
        if (y2 < y)
        {
            return "NE";
        }
    }
}
static int q1opt, q3opt;
static double compute_s1(int Q1, int K, int N) {
    double s1_min = 0.1;
    double Q1_opt = q1opt;
    double Q1_bad = N;

    if (Q1 <= Q1_opt) return 1.0;
    if (Q1 >= Q1_bad) return s1_min;

    double s1 = s1_min + (1 - s1_min) *
        (log(Q1_bad) - log(Q1)) /
        (log(Q1_bad) - log(Q1_opt));
    return s1;
}
int main()
{
    cin >> n >> k;

    for (int i = 0; i < k; i++)
    {
        int x;
        cin >> x;
        portal.push_back(x);
        pref[x]++;
    }
    for (int i = 1; i <= n; i++)
    {
        pref[i] += pref[i - 1];
    }
    cin >> m;

    for (int i = 0; i < m; i++)
    {
        int x, y, w;
        cin >> x >> y >> w;
        g.push_back({w, {x, y}});
    }

    cin >> f;

    for (int i = 0; i < f; i++)
    {
        int z;
        cin >> z;
        fortress.push_back(z);
    }
    cin >> L;
    cin >> x >> y;
    cin >> q1opt >> q3opt;
    
    double p1,p3;
    vector<int> ans = portals(n, k);
    sort(ans.begin(), ans.end());
    sort(portal.begin(), portal.end());
    if (ans == portal && q1 < 1e9)
    {
        p1=compute_s1(q1, k, n);
    }
    else
    {
        p1=0;
    }
    pair<int, int> second = minimal_danger(n, g, portal, fortress);
    //cout << "Second part: " << second.first << " " << second.second << endl;
    pair<int, int> cord = find_end_portal(L);
    if (cord.first == x && cord.second == y && q3 < 1e9)
    {
        p3=0.1+0.9*(1.0-pow(max((double)0,double(q3-q3opt)/double(L*L-q3opt)), 0.1));
    }
    else
    {
        p3=0;
    }
    cout << fixed << setprecision(6) << password << " " << max((double)0,p1) << " " << max((double)0,p3) << " " << second.first << " " << second.second << endl;
    if(q1>=1e9) {
        cout << "Invalid find_portals arguments!" << endl;
    }
    if(q3>=1e9) {
        cout << "Invalid throw_eye coordinates!" << endl;
    }
}