#include <math.h>
#include <algorithm>
#include <cctype>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>

int main() {
	std::string bench;
	std::getline(std::cin, bench); // Ignore the first line
	while (std::cin >> bench) {
		std::ofstream f(("results-" + bench + ".svg").c_str());
		f <<
		  "<?xml version='1.0' standalone='no'?>\n"
		  "<?xml-stylesheet href='diagram.css' type='text/css'?>\n"
		  "<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>\n"
		  "<svg width='100%' height='100%' version='1.1' xmlns='http://www.w3.org/2000/svg'>\n"
		  "<defs>\n"
		  "<linearGradient id='background' x1='0%' y1='0%' x2='100%' y2='0%'><stop offset='0%' style='stop-color:rgb(128,128,128);stop-opacity:1'/><stop offset='100%' style='stop-color:rgb(128,128,128);stop-opacity:0'/></linearGradient>\n"
		  "<linearGradient id='javabar' x1='0%' y1='0%' x2='0%' y2='100%'><stop offset='0%' style='stop-color:rgb(128,192,255); stop-opacity:1'/><stop offset='100%' style='stop-color:rgb(128,160,192); stop-opacity:1'/></linearGradient>\n"
		  "<linearGradient id='cppbar' x1='0%' y1='0%' x2='0%' y2='100%'><stop offset='0%' style='stop-color:rgb(128,255,128); stop-opacity:1'/><stop offset='100%' style='stop-color:rgb(128,192,128); stop-opacity:1'/></linearGradient>\n"
		  "</defs>\n";

		const size_t bars = 6;
		char const* bartitles[bars] = { "java -server", "gcc -O0", "-O1", "-O2", "-O3", "profiled" };
		double bartimes[bars];
		for (size_t i = 0; i < bars; ++i) std::cin >> bartimes[i];
		double mintime = *std::min_element(bartimes, bartimes + bars);
		
		const double hStart = 40.5;
		const double hRow = 35.0;
		const double hBar = 20.0;
		const double hInnerMargin = 10.0;
		const double wStart = 120.5;
		const double wBar = 500.0;
		double hEnd = hStart + bars * hRow + 2.0 * hInnerMargin;
		for (size_t i = 0; i < bench.size(); ++i) bench[i] = std::toupper(bench[i]);
		f <<
		  "<text x='" << wStart + wBar / 2.0 << "' y='" << hStart / 2.0 << "' class='title'>" << bench << " BENCHMARK RESULTS</text>\n";
		f <<
		  "<rect x='" << wStart << "' y='" << hStart << "' width='" << wBar << "' height='" << hEnd - hStart << "' class='diag' style='fill: url(#background)'/>\n"
		  "<polyline points='" << wStart << "," << hStart << " " << wStart << "," << hEnd << " " << wStart + wBar + 15.0 << "," << hEnd << "' class='bars'/>\n";
		for (int i = 1; i <= 10; ++i) {
			double x = wStart + wBar / 10.0 * i;
			f << "<line x1='" << x << "' y1='" << hStart << "' x2='" << x << "' y2='" << hEnd + 5.0 << "' class='scale'/><text x='" << x << "' y='" << hEnd + 10.0 << "' class='scale'>" << i * 10 << "</text>\n";
		}

		for (size_t i = 0; i < bars; ++i) {
			double yCenter = hStart + hInnerMargin + (i + 0.5) * hRow;
			std::string name = bartitles[i];
			double p = mintime / bartimes[i];
			int p_int = round(100.0 * p);
			std::ostringstream oss;
			if (p_int == 100) oss << "Fastest (";
			else oss << p_int << "&#x00A0;% (";
			oss << std::setprecision(2 + (bartimes[i] >= 100)) << bartimes[i] << "&#x00A0;s)";
			f <<
			  "<rect x='" << wStart << "' y='" << yCenter - hBar / 2.0 << "' rx='3' ry='3' width='" << p * wBar << "' height='" << hBar << "' class='bar' style='fill: url(#" << (i == 0 ? "javabar" : "cppbar") << ")'/>\n"
			  "<text x='" << wStart - 10.0 << "' y='" << yCenter << "' class='bar'>" << name << "</text>\n"
			  "<text x='" << wStart + p * wBar + 10.0 << "' y='" << yCenter << "' class='value'>" << oss.str() << "</text>\n";
		}

		f << "<text x='" << wStart + wBar / 2.0 << "' y='" << hEnd + 30.0 << "' class='xlabel'>Speed, percentage of the fastest</text>\n";

		f << "</svg>\n";
	}
}


