﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Problem_3___Endurance_Rally
{
    class Program
    {
        static void Main(string[] args)
        {
            var names = Console.ReadLine().Split().ToList();
            var trackZones = Console.ReadLine().Split().ToList();
            var checkPointsIndex = Console.ReadLine().Split().ToList();
            var listOfDrivers = new List<Driver>();
            var driverAndFuel = new Dictionary<string, decimal>();
            decimal fuel = 0; var reached = 0;

            foreach (var currentName in names)
            {
                var driver = new Driver();
                driver.Name = currentName;

                listOfDrivers.Add(driver);
            }
            for (int k = 0; k < listOfDrivers.Count; k++)
            {
                fuel = listOfDrivers[k].Fuel;
                for (int i = 0; i < trackZones.Count; i++)
                {
                    if (checkPointsIndex.Contains(i.ToString()))
                    {
                        fuel = fuel + decimal.Parse(trackZones[i]);

                    }
                    else
                    {
                        fuel = fuel - decimal.Parse(trackZones[i]);
                    }
                    if (fuel <= 0)
                    {
                        fuel = 0;
                        reached = i;
                        break;
                    }
                }
                if (!driverAndFuel.ContainsKey(listOfDrivers[k].Name))
                {
                    driverAndFuel.Add(listOfDrivers[k].Name, fuel);
                }

            }

            foreach (var driver in driverAndFuel)
            {
                if (driver.Value == 0)
                {
                    Console.WriteLine($"{driver.Key} - reached {reached}");

                }
                else
                {
                    Console.WriteLine($"{driver.Key} - fuel left {driver.Value:F2}");
                }
            }
        }
    }
    class Driver
    {
        public string Name { get; set; }

        public decimal Fuel
        {
            get
            {
                return System.Convert.ToInt32(Name.First());
            }
        }
        public int Zone { get; set; }
    }
}
