#!/usr/bin/perl
use Data::Dumper;
my($maze,$text_rank,$rank,$monster_list,$card_level,$halt_on_escape,$total_monsters,$release_rate,$timeout);
$halt_on_escape = 0;
for(my $ai=0;$ai<@ARGV;$ai++) {
    if($ARGV[$ai] =~ /^\d+$/) { if(!$total_monsters) { $total_monsters ||= $ARGV[$ai]; }
                                else { $release_rate ||= $ARGV[$ai]; } }
    elsif($ARGV[$ai] =~ /-rank/)  { $text_rank = $ARGV[++$ai]; }
    elsif($ARGV[$ai] =~ /-mon/)   { $monster_list = $ARGV[++$ai]; }
    elsif($ARGV[$ai] =~ /-level/) { $card_level = $ARGV[++$ai]; }
    elsif($ARGV[$ai] =~ /-halt/)  { $halt_on_escape = 1; }
}
$total_monsters ||= 1000;
$release_rate ||= 7;
$timeout = 10000; #maximum game length in "rounds" (16 minutes, 40 seconds of game time, not real time)
$maze = "x0x5x6x0x7x6x0x9x6x0x11x6x0x8x8x0x8x10x0x8x12x0x8x14x1x15x10x1x17x10x1x19x10x1x15x12x1x15x14x1x17x14x1x19x14x1x21x14x1x15x8x1x15x6x1x17x6x1x19x6x1x21x6x2x25x8x2x26x6x2x28x6x2x30x6x2x26x10x2x28x10x2x30x10x2x31x12x2x30x14x2x28x14x2x26x14x3x34x6x3x36x6x3x38x6x3x40x6x3x37x8x3x37x10x3x37x12x3x37x14x4x15x19x4x17x20x4x18x22x4x19x20x4x21x19x4x21x21x4x21x23x4x21x25x4x21x27x4x15x27x4x15x25x4x15x23x4x15x21x5x25x19x5x25x21x5x25x23x5x25x25x5x25x27x5x27x27x5x29x27x5x31x27x5x27x23x5x29x23x5x27x19x5x29x19x5x31x19x6x35x19x6x35x21x6x35x23x6x35x27x";

# How to run:
#
# 1) If you're using Windows, you'll probably need to install Perl for Windows.
#    If you're not technically savvy enough to do that, you may have some problems
#    with the simulator anyway. If you're not using Windows, you may have Perl
#    already. Not sure if Mac users have Perl by default with the BSD operating
#    system or not. And if you're using Linux or UNIX, you probably stopped reading
#    this step long ago.
#
# 2) Get to the command prompt. Windows users, go to Start->Run... and enter "cmd".
#    Mac users, do whatever it is you folks do to get a terminal window going. Linux
#    users, keep skipping ahead.
#
# 3) Within the command prompt, you're probably in a different directory than you
#    want to be in. Use the "cd" command to switch directories to the directory where
#    you put the simulator. For instance, if you put it in "C:\temp\maze_defense",
#    you'd type in "cd c:\temp\maze_defense" and hit <Enter>. Mac users, same diff,
#    you'd use something like "cd /temp/maze_defense".
#
# 4) Run the program, and put the output into the file of your choosing. It will be
#    in HTML format, so it's best to use a filename that ends in ".html". For example:
#
#    perl mdsim.pl > md_results.html
#
#    That will run a default simulation, and put the results into a file called
#    "md_results.html", which you can then look at in your web browser. Hooray!
#
# Setting up a simulation:
#
# 1) See that line way up above that says "$maze = "? Copy/paste your maze code in there,
#    (between the quotes) and that'll be the maze used for the simulation. You can use
#    either the "x0x1x2x..." format, or the URL of your maze's image. So these should be
#    equivalent:
#
#    $maze = "x0x44x14x0x44x19x";
#
#    $maze = "http://76.73.41.187/MazeImage.axd?data=Kw0AASsSAAE&l=5&cs=2DlAh2mhl7qix87oq0zzzg";
#
# 2) The program takes 2 arguments when you run it-- the number of monsters you'd like,
#    and the rate at which you'd like to have them released (per second). So if you
#    wanted to run a simulation with 1300 monsters, released at 5 per second, you'd run:
#
#    perl mdsim.pl 1300 5 > md_results.html
#
#    The default values are 1000 monsters at 7 monsters per second.
#
# 3) You may need to adjust the level of the monsters. You'll note that the same monster
#    attacking a Knight has different stats than when it attacks a Judicator. A little
#    further down in this file, you'll see the monster stats. And as you may have already
#    guessed, any line starting with a "#" is ignored, so you can remove potential
#    monsters by adding a "#" at the start of the line, or add them as potential monsters
#    by removing the "#". Or adjust their stats-- it's not hard.
#
# Understanding the results:
#
# When the simulator runs, you'll see numbers fly by. They're so you can keep an eye on
# how it's going. The 1st number tells you how many "game seconds" have happened (supposedly
# each step is 1/10 of a second each in game-speak). The second number tells you how many
# monsters are currently on the board. It will not tell you how many monsters have yet to
# come onto the board, waiting in the aisles.
# 
# The HTML output shows a summary of how the simulation went. At the top, it will tell
# you the number of monsters and release rate you used, as well as how many escaped and
# how long it took to run.
#
# Next, it'll show you a big map of the maze, with some stats. Each tower will take up a
# 2x2 square, and will tell you the type of tower (abbreviated), the number of shots it
# took, the total damage that it did, and what percentage of the time it was active. A
# tower that did NOT shoot during the simulation will be shown in blue.
#
# Each other square will show you the direction that a monster would go in if it were on
# that square, and the count of the number of times a monster spent a round on that square.
# A square that was never visited will show up in yellow (except the end square, which
# won't tell you anything useful). Note that the directions are shown using extended
# Unicode characters, and MSIE doesn't always recognize these (Firefox seems ok). You can
# change this further down in the code if you need to(search for the word "ASCII" to find it).
#
# === Disclaimer ===
#
# This program is provided without any warranty. By using this software, you agree to the
# following: David Eaton (the Author) is not responsible for any damage caused by this
# software including but not limited to data loss or hardware damage; the Author is not
# responsible for any errors or omissions that may result from the running of this program;
# the Author is under no obligation to support this software in any form. This program does
# not represent a perfect model of Maze Defense, and differences may exist in many
# varieties and severities. This program is provided for entertainment purposes only, and
# lays no claims to providing accurate data analysis.
#
# This program copyright 2009,2010 by David Eaton, Maze Defense copyright 2008-2010 Flavien Charlon.
#
# Maze encoding was developed by Thomas Besluau. View Thomas's Maze design program at:
# http://www.cocosinus.1s.fr/Facebook/Judicator.htm
#
# Thanks to Justin Robertson for providing the logic necessary for decrypting the maze URL!

if($maze =~ /data=/) {
    $maze = get_code_from_url($maze);
}

if($text_rank =~ /^[01234567]$/) {
    $rank = $text_rank; #easy!
} elsif($text_rank =~ /\bking\b/i || $text_rank =~ /^gk$/i) {
    $rank = 0;
} elsif($text_rank =~ /j/i) {
    $rank = 1;
} elsif($text_rank =~ /tem/i || $text_rank =~ /^ht$/i) {
    $rank = 2;
} elsif($text_rank =~ /guard/i || $text_rank =~ /^kg$/i) {
    $rank = 3;
} elsif($text_rank =~ /knight/i || $text_rank =~ /^kn?$/i) {
    $rank = 4;
} elsif($text_rank =~ /lord/i || $text_rank =~ /^ld?$/i) {
    $rank = 5;
} elsif($text_rank =~ /^p/i) {
    $rank = 6;
} elsif($text_rank =~ /sub/i || $text_rank =~ /^sp$/i) {
    $rank = 7;
} else {
    $rank = undef;
    if($text_rank =~ /\S+/) {
        print STDERR "Unrecognized rank: $text_rank\n";
    }
}

my(%turrets) = (
                0 => { name => "Basic Tower",
                       short => "Basic",
                       cost => 50,
                       reload => 2,
                       power => 10,
                       radius => 5,
                       splash => 0,
                       upgrades => [ { type => 1, cost => 200 },
                                     { type => 2, cost => 300 }, ], },
                1 => { name => "Automatic Tower",
                       short => "Auto",
                       cost => 250,
                       reload => 1.4,
                       power => 42,
                       radius => 6,
                       splash => 0,
                       upgrades => [ { type => 3, cost => 750 },
                                     { type => 4, cost => 1150 }, ], },
                2 => { name => "Heavy Tower",
                       short => "Heavy",
                       cost => 350,
                       reload => 1.8,
                       power => 100,
                       radius => 6,
                       splash => 0,
                       upgrades => [ { type => 5, cost => 1150 },
                                     { type => 14, cost => 850 }, ], },
                3 => { name => "Plasma",
                       short => "Plas.",
                       cost => 1000,
                       reload => 0.8,
                       power => 112,
                       radius => 7,
                       splash => 0,
                       upgrades => [ { type => 6, cost => 3800 }, ], },
                4 => { name => "Terragun",
                       short => "Tgun",
                       cost => 2000,
                       reload => 1,
                       power => 300,
                       radius => 9,
                       splash => 0,
                       upgrades => [ { type => 7, cost => 4000 }, ], },
                5 => { name => "Firebolt",
                       short => "Fbolt",
                       cost => 1500,
                       reload => 2,
                       power => 490,
                       radius => 6,
                       splash => 0,
                       upgrades => [ { type => 8, cost => 4900 },
                                     { type => 9, cost => 4500 }, ], },
                6 => { name => "Cryolaser",
                       short => "Cryo",
                       cost => 4600,
                       reload => 0.2,
                       power => 155,
                       radius => 9,
                       splash => 0,
                       upgrades => [ { type => 10, cost => 20200 },
                                     { type => 11, cost => 11200 }, ], },
                7 => { name => "Terrajoule Pulse Laser",
                       short => "Terjl",
                       cost => 5400,
                       reload => 1,
                       power => 790,
                       radius => 12,
                       splash => 0,
                       upgrades => [ { type => 16, cost => 33600 },
                                     { type => 13, cost => 26600 }, ], },
                8 => { name => "Megatron",
                       short => "Mega",
                       cost => 6400,
                       reload => 1.4,
                       power => 1410,
                       radius => 8,
                       splash => 0,
                       upgrades => [ { type => 13, cost => 25600 }, ], },
                9 => { name => "Cluster Bomb Cannon",
                       short => "Cbomb",
                       cost => 6000,
                       reload => 1.4,
                       power => 880,
                       radius => 8,
                       splash => 0.3,
                       upgrades => [ { type => 10, cost => 19000 },
                                     { type => 11, cost => 10000 },
                                     { type => 12, cost => 14000 }, ], },
                10 => { name => "Sonic Blaster",
                        short => "Sonic",
                        cost => 25000,
                        reload => 0.4,
                        power => 950,
                        radius => 9,
                        splash => 0.3,
                        upgrades => [ { type => 18, cost => 68000 }, ], },
                11 => { name => "Purple Ray Laser",
                        short => "Purp.",
                        cost => 16000,
                        reload => 0.8,
                        power => 1550,
                        radius => 15,
                        splash => 0,
                        upgrades => [ { type => 18, cost => 76000 }, ], },
                12 => { name => "Pyro Atomic Missile Launcher",
                        short => "Pyro",
                        cost => 20000,
                        reload => 1.2,
                        power => 1900,
                        radius => 9,
                        splash => 0.6,
                        upgrades => [ { type => 17, cost => 100000 }, ], },
                13 => { name => "BFG 40k",
                        short => "BFG",
                        cost => 32000,
                        reload => 1.2,
                        power => 3400,
                        radius => 13,
                        splash => 0.4,
                        upgrades => [ { type => 17, cost => 98000 }, ], },
                14 => { name => "Tachyon Field Generator",
                        short => "Tach.",
                        cost => 1200,
                        reload => 2.2,
                        power => 515,
                        radius => 4,
                        splash => 0,
                        upgrades => [ { type => 15, cost => 5500 }, ], },
                15 => { name => "Gemini Missile Launcher",
                        short => "Gem.",
                        cost => 6700,
                        reload => 3.4,
                        power => 3100,
                        radius => 17,
                        splash => 0,
                        upgrades => [ { type => 16, cost => 32300 },
                                      { type => 12, cost => 13300 }, ], },
                16 => { name => "Photon Cannon",
                        short => "Phot.",
                        cost => 39000,
                        reload => 0.8,
                        power => 3900,
                        radius => 8,
                        splash => 0,
                        upgrades => [ { type => 17, cost => 81000 },
                                      { type => 18, cost => 53000 }, ], },
                17 => { name => "Neutron Flare",
                        short => "Neutr",
                        cost => 92000,
                        reload => 0.3,
                        power => 2800,
                        radius => 10,
                        splash => 0,
                    },
                18 => { name => "Antimatter Missile Base",
                        short => "AMB",
                        cost => 120000,
                        reload => 2.8,
                        power => 26000,
                        radius => 13,
                        splash => 0.7,
                    },
	    );

my(%m_types);
#if someone specified a rank and monster list, use that!
if(defined($rank) && $monster_list =~ /\d/) {
    my(@ids) = split /\D+/,$monster_list;
    if(@ids) {
        my $list = get_monsters($rank,\@ids);
        foreach my $monster (@{$list}) {
            $m_types{$monster->{id}} = { health => $monster->{health}, speed => $monster->{speed} };
        }
    }
}
if(!(keys %m_types)) {
    #Default monster list
    %m_types = (
        36 => { health => 9040, speed => 3.08, },
        37 => { health => 10110, speed => 2.83, },
        38 => { health => 12170, speed => 2.94, },
        39 => { health => 12620, speed => 2.15, },
        40 => { health => 12870, speed => 2.36, },
        );
}

my($maxy,$maxx,@map,$x,$y,%types);
$maxy = 34; #33 squares for towers, plus 2 border
$maxx = 49; #48 squares for towers, plus 2 border

my($x,$y);
for($x=0;$x<=$maxx;$x++) {
    $map[$x][0] = "X";
    $map[$x][$maxy] = "X";
}
for($y=0;$y<=$maxy;$y++) {
    $map[0][$y] = "X";
    $map[$maxx][$y] = "X";
}
$map[$maxx][17] = ""; #the exit!
@starting_positions = (	{'x'=>0,'y'=>0},
			{'x'=>1,'y'=>0},
			{'x'=>2,'y'=>0},
			{'x'=>3,'y'=>0},
			{'x'=>18,'y'=>0},
			{'x'=>19,'y'=>0},
			{'x'=>20,'y'=>0},
			{'x'=>21,'y'=>0},
			{'x'=>22,'y'=>0},
			{'x'=>23,'y'=>0},
			{'x'=>24,'y'=>0},
			{'x'=>0,'y'=>1},
			{'x'=>0,'y'=>2},
			{'x'=>0,'y'=>3},
			{'x'=>0,'y'=>14},
			{'x'=>0,'y'=>15},
			{'x'=>0,'y'=>16},
			{'x'=>0,'y'=>17},
			{'x'=>0,'y'=>18},
			{'x'=>0,'y'=>19},
			{'x'=>0,'y'=>20},
			{'x'=>0,'y'=>$maxy-3},
			{'x'=>0,'y'=>$maxy-2},
			{'x'=>0,'y'=>$maxy-1},
			{'x'=>0,'y'=>$maxy},
			{'x'=>1,'y'=>$maxy},
			{'x'=>2,'y'=>$maxy},
			{'x'=>3,'y'=>$maxy},
			{'x'=>18,'y'=>$maxy},
			{'x'=>19,'y'=>$maxy},
			{'x'=>20,'y'=>$maxy},
			{'x'=>21,'y'=>$maxy},
			{'x'=>22,'y'=>$maxy},
			{'x'=>23,'y'=>$maxy},
			{'x'=>24,'y'=>$maxy}, );
foreach my $p (@starting_positions) {
    $map[$p->{x}][$p->{y}] = "";
}

while($maze =~ s/^x(\d+)x(\d+)x(\d+)//) {
    my($type,$x,$y) = ($1,$2,$3);
    $types{$type}++;
    if(length($map[$x][$y]) ||
       length($map[$x+1][$y]) ||
       length($map[$x][$y+1]) ||
       length($map[$x+1][$y+1])) {
	print STDERR "ACK! at $x,$y\n";
	print STDERR "Invalid maze specification! Dying!\n";
	exit(1);
    }
    $map[$x][$y] = $type;
    push @towers,{ type => $type, cx => $x+1, cy => $y+1, recharge => 0, };
    $map[$x+1][$y] = "skip";
    $map[$x][$y+1] = "skip";
    $map[$x+1][$y+1] = "skip";
    $maxy = $y+1 if($y+1 > $maxy);
    $maxx = $x+1 if($x+1 > $maxx);
}

print STDERR "Finding min paths\n";
my $mapdist = find_min_paths(\@map,$maxx,17,$maxx,$maxy); #map, endpoint, maxes

foreach my $p (@starting_positions) {
    if($mapdist->[$p->{x}][$p->{y}]{dir} !~ /[uldr]/) {
	print STDERR "Blocked path! Invalid maze!\n";
	exit(1);
    }
}

print STDERR "Prepping towers\n";
my($i) = 0;
foreach my $tower (@towers) {
    $i++;
    print STDERR "Processing tower $i\n";
    for($x=0;$x<=$maxx;$x++) {
	for($y=0;$y<=$maxy;$y++) {
            next if(length($map[$x][$y]));
	    $dist = sqrt(($tower->{cx}-($x+0.5))**2+($tower->{cy}-($y+0.5))**2);
	    if($dist <= ($turrets{$tower->{type}}{radius}+1.42)) {
		push @{$tower->{inrange}},[$x,$y,$dist];
	    }
	}
    }
    @{$tower->{inrange}} = sort { $a->[2] <=> $b->[2] || int(rand 3)-1 } @{$tower->{inrange}};
}
print STDERR "Done tower prep\n";

@pending_monsters = ();
my(@m_typelist) = keys %m_types;
if(!@m_typelist) {
    print STDERR "No valid monster types! Exiting!\n";
    exit(1);
}
for($i=0;$i<$total_monsters;$i++) {
    my(%monster) = (dist => 0);
    my $r = int(rand (scalar @m_typelist));
    my($type) = $m_typelist[$r];
    $monster{health} = $m_types{$type}{health};
    $monster{speed} = $m_types{$type}{speed};
    my $rp = int(rand @starting_positions);
    $monster{x} = $starting_positions[$rp]{x};
    $monster{y} = $starting_positions[$rp]{y};
    push @pending_monsters,\%monster;
}
@monsters = ();
$escaped = 0;
$start_time = time();
$| = 1;
my($release_count) = 0;
while($release_rate >= 10) { $release_rate -= 10; $release_count++; }
@bullets = ();
for($iter=0;$iter<$timeout;$iter++) {
    print STDERR sprintf("%.1f sec., ",$iter/10).scalar(@monsters)." mon., ".scalar(@pending_monsters)." waiting\n";
    if(@pending_monsters) {
	for(my $i=0;$i<$release_count;$i++) {
	    if(@pending_monsters) {
		push @monsters,pop @pending_monsters;
	    }
	}
	if(@pending_monsters) {
	    my($enter_now) = rand 10;
	    if($enter_now < $release_rate) {
		push @monsters,pop @pending_monsters;
	    }
	}
    }
    @msquares = ();
    MONSTER: for($mi=0;$mi<@monsters;$mi++) {
	$monster = $monsters[$mi];
	#next if($monster->{done});
	$monster->{dist} += ($monster->{speed}/10);
	$square = $mapdist->[$monster->{x}][$monster->{y}];
	$square->{visited}++;
	if($monster->{dist} > $square->{plen}) {
	    $monster->{dist} -= $square->{plen};
	    $monster->{x} = $square->{tox};
	    $monster->{y} = $square->{toy};
	    if($monster->{x} == $maxx && $monster->{y} == 17) {
		#He made it! Cull him from the list!
		$escaped++;
		splice @monsters,$mi,1;
		#adjust bullet target id's
		for(my $bi=0;$bi<@bullets;$bi++) {
		    if($bullets[$bi]{target} == $mi) {
			splice @bullets,$bi,1;
			$bi--;
		    } elsif($bullets[$bi]{target} > $mi) {
			$bullets[$bi]{target}--;
		    }
		}
		$mi--;
		next MONSTER;
	    }
	    $square = $mapdist->[$monster->{x}][$monster->{y}]; #re-set when they move
	}
	push @{$msquares[$monster->{x}][$monster->{y}]},$mi;
	#Calculate actual monster position:
	if($square->{dir} eq "u") { $monster->{px} = $monster->{x}+0.5; $monster->{py} = $monster->{y}+0.5-$monster->{dist}; }
	elsif($square->{dir} eq "d") { $monster->{px} = $monster->{x}+0.5; $monster->{py} = $monster->{y}+0.5+$monster->{dist}; }
	elsif($square->{dir} eq "l") { $monster->{px} = $monster->{x}+0.5-$monster->{dist}; $monster->{py} = $monster->{y}+0.5; }
	elsif($square->{dir} eq "r") { $monster->{px} = $monster->{x}+0.5+$monster->{dist}; $monster->{py} = $monster->{y}+0.5; }
	elsif($square->{dir} eq "ul") { $monster->{px} = $monster->{x}+0.5-$monster->{dist}*0.70710678;
					$monster->{py} = $monster->{y}+0.5-$monster->{dist}*0.70710678; }
	elsif($square->{dir} eq "ur") { $monster->{px} = $monster->{x}+0.5+$monster->{dist}*0.70710678;
					$monster->{py} = $monster->{y}+0.5-$monster->{dist}*0.70710678; }
	elsif($square->{dir} eq "dl") { $monster->{px} = $monster->{x}+0.5-$monster->{dist}*0.70710678;
					$monster->{py} = $monster->{y}+0.5+$monster->{dist}*0.70710678; }
	elsif($square->{dir} eq "dr") { $monster->{px} = $monster->{x}+0.5+$monster->{dist}*0.70710678;
					$monster->{py} = $monster->{y}+0.5+$monster->{dist}*0.70710678; }
    }
    my(%cull_list) = ();
    #Process any bullets that are still in mid-air
    for($bi=0;$bi<@bullets;$bi++) {
	$bullets[$bi]{dist} -= 1.5; #Wrong! Bullets move at differing speeds, not sure the correct stats!
	#Note, really, this should take longer if a monster is moving away from
	#the bullet, and be quicker if they're moving towards the bullet.
	#But screw that, I'd really rather not re-calculate trajectory for all
	#the difference that it'll make.
	if($bullets[$bi]{dist} <= 0) {
	    my($target) = $bullets[$bi]{target};
	    my($monster_count) = scalar(@monsters);
	    if($monsters[$target]{health} >= $bullets[$bi]{power}) {
		$towers[$bullets[$bi]{from}]{damage_done} += $bullets[$bi]{power};
	    } elsif($monsters[$target]{health} > 0) {
		$towers[$bullets[$bi]{from}]{damage_done} += $monsters[$target]{health};
		$towers[$bullets[$bi]{from}]{damage_lost} += ($bullets[$bi]{power} - $monsters[$target]{health});
	    }
	    $monsters[$target]{health} -= $bullets[$bi]{power};
	    $cull_list{$target}++;
	    if($bullets[$bi]{splash} > 0) {
		my($sx,$xy);
		my($ox,$oy) = ($monsters[$target]{px},$monsters[$target]{py});
		for($sx=$monsters[$target]{x}-2;$sx<=$monsters[$target]{x}+2;$sx++) {
		    next if($sx < 0 || $sx > $maxx);
		    for($sy=$monsters[$target]{y}-2;$sy<=$monsters[$target]{y}+2;$sy++) {
			next if($sy < 0 || $sy > $maxy);
			foreach my $mi (@{$msquares[$sx][$sy]}) {
			    next if($mi eq $target); #already counted
			    my($dist) = sqrt(($monsters[$mi]{px}-$ox)**2+($monsters[$mi]{py}-$oy)**2);
			    if($dist <= $bullets[$bi]{splash}) {
				if($monsters[$mi]{health} >= $bullets[$bi]{power}) {
				    $towers[$bullets[$bi]{from}]{total_splash} += $bullets[$bi]{power};
				} elsif($monsters[$mi]{health} > 0) {
				    $towers[$bullets[$bi]{from}]{total_splash} += $monsters[$mi]{health};
				    $towers[$bullets[$bi]{from}]{lost_splash} += ($bullets[$bi]{power} - $monsters[$mi]{health});
				}
				$monsters[$mi]{health} -= $bullets[$bi]{power};
				$cull_list{$mi}++;
			    }
			}
		    }
		}
            }
	    splice @bullets,$bi,1;
	    $bi--;
	}
    }
    #Fire any towers that are capable of doing so
    my($ti) = -1;
    foreach my $tower (@towers) {
	$ti++;
	if($tower->{recharge} > 0) { $tower->{recharge} -= 0.1; next; }
	$target = -1;
	$min = 1000;
	my($dist);
	TSQUARE: foreach my $square (@{$tower->{inrange}}) {
	    foreach my $mi (@{$msquares[$square->[0]][$square->[1]]}) {
		$dist = sqrt(($monsters[$mi]{px} - $tower->{cx})**2 + ($monsters[$mi]{py} - $tower->{cy})**2);
		if($dist <= $turrets{$tower->{type}}{radius}) {
		    #note, this isn't REALLY shooting at the closest target, which may be affecting the
		    #simulation. Not sure. It's just the first one it finds that's in the closest square
		    $target = $mi;
		    last TSQUARE;
		}
	    }
	}
	if($target >= 0) {
	    $tower->{shots}++;
	    $tower->{recharge} = $turrets{$tower->{type}}{reload};
	    my($bullet) = { from => $ti, power => $turrets{$tower->{type}}{power}, target => $target, dist => $dist, splash => $turrets{$tower->{type}}{splash} };
	    push @bullets,$bullet;
	}
    }
    #Clean out the monster list of any monsters who got killed
    foreach my $mi (sort {$b <=> $a} (keys %cull_list)) {
	if($monsters[$mi]{health} <= 0) {
	    #print "Monster $mi killed on $iter!\n";
	    splice @monsters,$mi,1;
	    #remove or adjust any bullets currently in the air going towards this monster, or else they'll damage DIFFERENT monsters!
	    for($bi=0;$bi<@bullets;$bi++) {
		if($bullets[$bi]{target} == $mi) { splice @bullets,$bi,1; $bi--; }
		elsif($bullets[$bi]{target} > $mi) { $bullets[$bi]{target}--; }
	    }
	}
    }
    if(!@monsters && !@pending_monsters) {
	#No more monsters to kill!
	last;
    }
    if($escaped && $halt_on_escape) {
	last;
    }
}
$end_time = time();
print qq`<html><head><style type="text/css">
  body {
    font-family: Verdana;
    font-size: 10px;
  }
  table {
    font-family: Verdana;
    font-size: 10px;
  }
</style></head><body>`;

print "Total Monsters: $total_monsters<br>\n";
print "Release Rate: ".($release_count*10+$release_rate)."/second<br>\n";
print "Escaped: $escaped<br>\n";
print "Duration: $iter rounds (".sprintf("%.1f game seconds",$iter/10)."), about ".($end_time - $start_time + 1)." actual seconds to process<br>\n";

my($activation_total) = 0;
my($ti) = 0;
my($total_damage) = 0;
my($theoretical_pdps) = 0;
my($theoretical_sdps) = 0;
my($total_splash) = 0;
my($total_lost_damage) = 0;
my($total_lost_splash) = 0;
foreach my $tower (@towers) {
    my($active) = ($tower->{shots} * $turrets{$tower->{type}}{reload})/($iter/10);
    if($active > 1) { $active = 1; }
    $activation_total += $active;
    $total_damage += $tower->{damage_done};
    $total_lost_damage += $tower->{damage_lost};
    $total_splash += $tower->{total_splash};
    $total_lost_splash += $tower->{lost_splash};
    $theoretical_pdps += ($turrets{$tower->{type}}{power}/$turrets{$tower->{type}}{reload});
    if($turrets{$tower->{type}}{splash}) {
	$theoretical_sdps += ($turrets{$tower->{type}}{power}/$turrets{$tower->{type}}{reload});
    }
    $mapdist->[$tower->{cx}-1][$tower->{cy}-1]{shots} = $tower->{shots};
    $mapdist->[$tower->{cx}-1][$tower->{cy}-1]{total_splash} = $tower->{total_splash};
    $mapdist->[$tower->{cx}-1][$tower->{cy}-1]{damage_done} = $tower->{damage_done};
    $mapdist->[$tower->{cx}-1][$tower->{cy}-1]{active} = sprintf("%.2f",$active*100);
    $mapdist->[$tower->{cx}-1][$tower->{cy}-1]{ti} = $ti;
    $ti++;
}
print "Activation Average: ".sprintf("%.2f",(($activation_total*100)/$ti))."\%<br>\n";
print "<br>\n";
print "Total point damage: $total_damage<br>\n";
print "Total point damage lost to overkill: $total_lost_damage (".sprintf("%.2f",(100*$total_lost_damage)/($total_lost_damage+$total_damage))."\%)<br>\n";
print "Theoretical point DPS: ".sprintf("%.2f",$theoretical_pdps)."<br>\n";
print "Actual point DPS: ".sprintf("%.2f",($total_damage*10/$iter))." (".sprintf("%.2f",(100*($total_damage*10/$iter)/$theoretical_pdps))."\% of theoretical)<br>\n";
print "<br>\n";
print "Total splash damage: $total_splash<br>\n";
print "Total splash damage lost to overkill: $total_lost_splash<br>\n";
print "Theoretical splash DPS: ".sprintf("%.2f",$theoretical_sdps)."<br>\n";
print "Actual splash DPS: ".sprintf("%.2f",($total_splash*10/$iter))."<br>\n";
print "<br>\n";
print "Total damage output: ".($total_damage+$total_splash)."<br>\n";
print "Total damage lost to overkill: ".($total_lost_damage+$total_lost_splash)."<br>\n";
print "Actual total DPS: ".sprintf("%.2f",(($total_damage+$total_splash)*10/$iter))."<br>\n";
print "<table border=0 cellspacing=0 cellpadding=0>";
my($cellsize) = 25;
for($y=0;$y<=$maxy;$y++) {
    print "<tr>";
    for($x=0;$x<=$maxx;$x++) {
        if(!length($map[$x][$y])) {
	    if($mapdist->[$x][$y]{visited}) {
		$color = "#FFBF8F";
	    } else {
		$color = "#EFEF8F";
	    }
	    print "<td bgcolor=\"$color\" style=\"text-align: center; width: $cellsize"."px; border: 1px black solid;\">";
	    #Old ASCII, bleah
	    #if($mapdist->[$x][$y]{dir} eq "ul") { print "`"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "u") { print "^"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "ur") { print "'"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "l") { print "<"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "r") { print ">"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "dl") { print ","; }
	    #elsif($mapdist->[$x][$y]{dir} eq "d") { print "v"; }
	    #elsif($mapdist->[$x][$y]{dir} eq "dr") { print "\\"; }
	    #Fancy Unicode! (MSIE sometimes doesn't like this)
	    if($mapdist->[$x][$y]{dir} eq "ul") { print "&#8598;"; }
	    elsif($mapdist->[$x][$y]{dir} eq "u") { print "&#8593;"; }
	    elsif($mapdist->[$x][$y]{dir} eq "ur") { print "&#8599;"; }
	    elsif($mapdist->[$x][$y]{dir} eq "l") { print "&#8592;"; }
	    elsif($mapdist->[$x][$y]{dir} eq "r") { print "&#8594"; }
	    elsif($mapdist->[$x][$y]{dir} eq "dl") { print "&#8601;"; }
	    elsif($mapdist->[$x][$y]{dir} eq "d") { print "&#8595"; }
	    elsif($mapdist->[$x][$y]{dir} eq "dr") { print "&#8600"; }
	    else { print "?"; }
	    print "<br>".($mapdist->[$x][$y]{visited} || "&nbsp;");
	    print "</td>"; }
	elsif($map[$x][$y] eq "X") { print "<td bgcolor=\"#CFCF8F\" style=\"width: ".$cellsize."px; \">&nbsp;</td>"; }
	elsif($map[$x][$y] ne "skip") { if($mapdist->[$x][$y]{shots} > 0) { $color = "#CF80FF"; }
					else { $color = "#8080FF"; }
					$damage = $mapdist->[$x][$y]{damage_done} + $mapdist->[$x][$y]{total_splash};
					print "<td style=\"border: 1px black solid;\" bgcolor=\"$color\" rowspan=2 colspan=2>";
					print "<div style=\"text-align: center;\">$turrets{$map[$x][$y]}{short}</div>";
					print "Shot:<b>$mapdist->[$x][$y]{shots}</b><br>";
					print "Dmg:<b>$damage</b><br>";
					print "Act:<b>$mapdist->[$x][$y]{active}\%</b>";
					print "</td>"; }
    }
    print "<td><img src=\"\" width=1 height=$cellsize style=\"visibility: hidden;\"></td>\n";
    print "</tr>\n";
}
for($x=0;$x<=$maxx;$x++) {
    print "<td><img src=\"\" width=$cellsize height=1 style=\"visibility: hidden;\"></td>\n";
}
print "</table>\n";
print "</body>\n</html>\n";

sub find_min_paths {
    my($map,$startx,$starty,$maxx,$maxy) = @_;
    my(@nodes) = ();
    my($x,$y,$more);
    $more = 0;
    for($x=0;$x<=$maxx;$x++) {
	for($y=0;$y<=$maxy;$y++) {
	    $nodes[$x][$y]{dist} = -1;
	}
    }
    $nodes[$startx][$starty]{dist} = 1;
    my(%visit_list) = ( "$startx,$starty" => 1 );
    while(keys %visit_list) {
	my($node) = '';
	my($nx,$ny);
	foreach my $n (keys %visit_list) {
	    ($x,$y) = split /,/,$n; #/ #stupid comment for emacs syntax highlighting
	    if(!$node || $nodes[$x][$y]{dist} < $nodes[$nx][$ny]{dist}) {
		$node = $n;
		$nx = $x;
		$ny = $y;
	    }
	}
	return if(!length($node));
	PAIR: foreach my $pair ( { 'x' => $nx-1, 'y' => $ny-1, dir => 'dr', dist => 1.41421356, check => [ {x=>$nx,y=>$ny-1}, {x=>$nx-1,y=>$ny} ] },
				 { 'x' => $nx,   'y' => $ny-1, dir => 'd',  dist => 1 },
				 { 'x' => $nx+1, 'y' => $ny-1, dir => 'dl', dist => 1.41421356, check => [ {x=>$nx,y=>$ny-1}, {x=>$nx+1,y=>$ny} ] },
				 { 'x' => $nx-1, 'y' => $ny,   dir => 'r',  dist => 1 },
				 { 'x' => $nx+1, 'y' => $ny,   dir => 'l',  dist => 1 },
				 { 'x' => $nx-1, 'y' => $ny+1, dir => 'ur', dist => 1.41421356, check => [ {x=>$nx,y=>$ny+1}, {x=>$nx-1,y=>$ny} ] },
				 { 'x' => $nx,   'y' => $ny+1, dir => 'u',  dist => 1 },
				 { 'x' => $nx+1, 'y' => $ny+1, dir => 'ul', dist => 1.41421356, check => [ {x=>$nx,y=>$ny+1}, {x=>$nx+1,y=>$ny} ] }, ) {
	    next if($pair->{x} < 0 || $pair->{x} > $maxx || $pair->{y} < 0 || $pair->{y} > $maxy);
	    next if(length($map->[$pair->{x}][$pair->{y}]));
	    #Can't go diagonally unless clear
	    foreach my $check (@{$pair->{check}}) {
		next PAIR if(length($map->[$check->{x}][$check->{y}]));
	    }
	    my($d) = $nodes[$nx][$ny]{dist} + $pair->{dist};
	    next if($nodes[$pair->{x}][$pair->{y}]{dist} != -1 && $nodes[$pair->{x}][$pair->{y}]{dist} <= $d);
	    #Yay, found a shorter, clear path
	    my($visit) = "$pair->{x},$pair->{y}";
	    $visit_list{$visit}++;
	    $nodes[$pair->{x}][$pair->{y}]{dist} = $d;
	    $nodes[$pair->{x}][$pair->{y}]{tox} = $nx;
	    $nodes[$pair->{x}][$pair->{y}]{toy} = $ny;
	    $nodes[$pair->{x}][$pair->{y}]{plen} = $pair->{dist};
	    $nodes[$pair->{x}][$pair->{y}]{dir} = $pair->{dir};
	}
	delete $visit_list{$node};
    }
    return \@nodes;
}

sub get_code_from_url {
    my($url) = @_;

    local(%trans_tower) = (
	# Block A      Block A        Block A        Block B        Block C
	'A.AQ' => '0', 'A.AR' => '0', 'A.AS' => '0', 'B.AE' => '0', 'C.B' => '0',
	'A.Ag' => '1', 'A.Ah' => '1', 'A.Ai' => '1', 'B.AI' => '1', 'C.C' => '1',
	'A.Aw' => '2', 'A.Ax' => '2', 'A.Ay' => '2', 'B.AM' => '2', 'C.D' => '2',
	'A.BA' => '3', 'A.BB' => '3', 'A.BC' => '3', 'B.AQ' => '3', 'C.E' => '3',
	'A.Bg' => '4', 'A.Bh' => '4', 'A.Bi' => '4', 'B.AY' => '4', 'C.G' => '4',
	'A.BQ' => '5', 'A.BR' => '5', 'A.BS' => '5', 'B.AU' => '5', 'C.F' => '5',
	'A.CA' => '6', 'A.CB' => '6', 'A.CC' => '6', 'B.Ag' => '6', 'C.I' => '6',
	'A.CQ' => '7', 'A.CR' => '7', 'A.CS' => '7', 'B.Ak' => '7', 'C.J' => '7',
	'A.Bw' => '8', 'A.Bx' => '8', 'A.By' => '8', 'B.Ac' => '8', 'C.H' => '8',
	'A.Cg' => '9', 'A.Ch' => '9', 'A.Ci' => '9', 'B.Ao' => '9', 'C.K' => '9',
	'A.DQ' => '10', 'A.DR' => '10', 'A.DS' => '10', 'B.A0' => '10', 'C.N' => '10',
	'A.Cw' => '11', 'A.Cx' => '11', 'A.Cy' => '11', 'B.As' => '11', 'C.L' => '11',
	'A.DA' => '12', 'A.DB' => '12', 'A.DC' => '12', 'B.Aw' => '12', 'C.M' => '12',
	'A.Dg' => '13', 'A.Dh' => '13', 'A.Di' => '13', 'B.A4' => '13', 'C.O' => '13',
	'A.Dw' => '14', 'A.Dx' => '14', 'A.Dy' => '14', 'B.A8' => '14', 'C.P' => '14',
	'A.EA' => '15', 'A.EB' => '15', 'A.EC' => '15', 'B.BA' => '15', 'C.Q' => '15',
	'A.EQ' => '16', 'A.ER' => '16', 'A.ES' => '16', 'B.BE' => '16', 'C.R' => '16',
	'A.Eg' => '17', 'A.Eh' => '17', 'A.Ei' => '17', 'B.BI' => '17', 'C.S' => '17',
	'A.Ew' => '18', 'A.Ex' => '18', 'A.Ey' => '18', 'B.BM' => '18', 'C.T' => '18',
	);
    
    local(%trans_x) = (
	"A.AA" => 1, "A.AB" => 1, "A.AQ" => 2, "A.AR" => 2, "A.Ag" => 3, "A.Ah" => 3, "A.Aw" => 4, "A.Ax" => 4,
	"A.BA" => 5, "A.BB" => 5, "A.BQ" => 6, "A.BR" => 6, "A.Bg" => 7, "A.Bh" => 7, "A.Bw" => 8, "A.Bx" => 8,
	"A.CA" => 9, "A.CB" => 9, "A.CQ" => 10, "A.CR" => 10, "A.Cg" => 11, "A.Ch" => 11, "A.Cw" => 12, "A.Cx" => 12,
	"A.DA" => 13, "A.DB" => 13, "A.DQ" => 14, "A.DR" => 14, "A.Dg" => 15, "A.Dh" => 15, "A.Dw" => 16, "A.Dx" => 16,
	"A.EA" => 17, "A.EB" => 17, "A.EQ" => 18, "A.ER" => 18, "A.Eg" => 19, "A.Eh" => 19, "A.Ew" => 20, "A.Ex" => 20,
	"A.FA" => 21, "A.FB" => 21, "A.FQ" => 22, "A.FR" => 22, "A.Fg" => 23, "A.Fh" => 23, "A.Fw" => 24, "A.Fx" => 24,
	"A.GA" => 25, "A.GB" => 25, "A.GQ" => 26, "A.GR" => 26, "A.Gg" => 27, "A.Gh" => 27, "A.Gw" => 28, "A.Gx" => 28,
	"A.HA" => 29, "A.HB" => 29, "A.HQ" => 30, "A.HR" => 30, "A.Hg" => 31, "A.Hh" => 31, "A.Hw" => 32, "A.Hx" => 32,
	"A.IA" => 33, "A.IB" => 33, "A.IQ" => 34, "A.IR" => 34, "A.Ig" => 35, "A.Ih" => 35, "A.Iw" => 36, "A.Ix" => 36,
	"A.JA" => 37, "A.JB" => 37, "A.JQ" => 38, "A.JR" => 38, "A.Jg" => 39, "A.Jh" => 39, "A.Jw" => 40, "A.Jx" => 40,
	"A.KA" => 41, "A.KB" => 41, "A.KQ" => 42, "A.KR" => 42, "A.Kg" => 43, "A.Kh" => 43, "A.Kw" => 44, "A.Kx" => 44,
	"A.LA" => 45, "A.LB" => 45, "A.LQ" => 46, "A.LR" => 46, "A.Lg" => 47, "A.Lh" => 47, "A.Lw" => 48, "A.Lx" => 48,
	"B.0.A" => 1, "B.0.E" => 2 , "B.0.I" => 3, "B.0.M" => 4, "B.0.Q" => 5, "B.0.U" => 6, "B.0.Y" => 7, "B.0.c" => 8,
	"B.0.g" => 9, "B.0.k" => 10, "B.0.o" => 11, "B.0.s" => 12, "B.0.w" => 13, "B.0.0" => 14, "B.0.4" => 15, "B.0.8" => 16,
	"B.1.A" => 17, "B.1.E" => 18 , "B.1.I" => 19, "B.1.M" => 20, "B.1.Q" => 21, "B.1.U" => 22, "B.1.Y" => 23, "B.1.c" => 24,
	"B.1.g" => 25, "B.1.k" => 26, "B.1.o" => 27, "B.1.s" => 28, "B.1.w" => 29, "B.1.0" => 30, "B.1.4" => 31, "B.1.8" => 32,
	"B.2.A" => 33, "B.2.E" => 34 , "B.2.I" => 35, "B.2.M" => 36, "B.2.Q" => 37, "B.2.U" => 38, "B.2.Y" => 39, "B.2.c" => 40,
	"B.2.g" => 41, "B.2.k" => 42, "B.2.o" => 43, "B.2.s" => 44, "B.2.w" => 45, "B.2.0" => 46, "B.2.4" => 47, "B.2.8" => 48,
	"C.A" => 1, "C.B" => 2, "C.C" => 3, "C.D" => 4, "C.E" => 5, "C.F" => 6, "C.G" => 7, "C.H" => 8,
	"C.I" => 9, "C.J" => 10, "C.K" => 11, "C.L" => 12, "C.M" => 13, "C.N" => 14, "C.O" => 15, "C.P" => 16,
	"C.Q" => 17, "C.R" => 18, "C.S" => 19, "C.T" => 20, "C.U" => 21, "C.V" => 22, "C.W" => 23, "C.X" => 24,
	"C.Y" => 25, "C.Z" => 26, "C.a" => 27, "C.b" => 28, "C.c" => 29, "C.d" => 30, "C.e" => 31, "C.f" => 32,
	"C.g" => 33, "C.h" => 34, "C.i" => 35, "C.j" => 36, "C.k" => 37, "C.l" => 38, "C.m" => 39, "C.n" => 40,
	"C.o" => 41, "C.p" => 42, "C.q" => 43, "C.r" => 44, "C.s" => 45, "C.t" => 46, "C.u" => 47, "C.v" => 48,
	);

    local(%trans_y) = (
	"A.A.A" => 1,"A.A.E" => 2,"A.A.I" => 3,"A.A.M" => 4,"A.A.Q" => 5,"A.A.U" =>  6,"A.A.Y" =>  7,"A.A.c" =>  8,
	"A.A.g" =>  9,"A.A.k" =>  10,"A.A.o" =>  11,"A.A.s" =>  12,"A.A.w" =>  13,"A.A.0" =>  14,"A.A.4" =>  15,"A.A.8" =>  16,
	"A.B.A" => 17,"A.B.E" => 18,"A.B.I" => 19,"A.B.M" => 20,"A.B.Q" => 21,"A.B.U" =>  22,"A.B.Y" =>  23,"A.B.c" =>  24,
	"A.B.g" =>  25,"A.B.k" =>  26,"A.B.o" =>  27,"A.B.s" =>  28,"A.B.w" =>  29,"A.B.0" =>  30,"A.B.4" =>  31,"A.B.8" =>  32,
	"B.A" =>  1,"B.B" =>  2,"B.C" =>  3,"B.D" =>  4,"B.E" =>  5,"B.F" =>  6,"B.G" =>  7,"B.H" =>  8,
	"B.I" =>  9,"B.J" =>  10,"B.K" =>  11,"B.L" =>  12,"B.M" =>  13,"B.N" =>  14,"B.O" =>  15,"B.P" =>  16,
	"B.Q" =>  17,"B.R" =>  18,"B.S" =>  19,"B.T" =>  20,"B.U" =>  21,"B.V" =>  22,"B.W" =>  23,"B.X" =>  24,
	"B.Y" =>  25,"B.Z" =>  26,"B.a" =>  27,"B.b" =>  28,"B.c" =>  29,"B.d" =>  30,"B.e" =>  31,"B.f" =>  32,"B.g" =>  33,
	"C.AA" =>  1,"C.AQ" =>  2,"C.Ag" =>  3,"C.Aw" =>  4,"C.BA" =>  5,"C.BQ" =>  6,"C.Bg" =>  7,"C.Bw" =>  8,
	"C.CA" =>  9,"C.CQ" =>  10,"C.Cg" =>  11,"C.Cw" =>  12,"C.DA" =>  13,"C.DQ" =>  14,"C.Dg" =>  15,"C.Dw" =>  16,
	"C.EA" =>  17,"C.EQ" =>  18,"C.Eg" =>  19,"C.Ew" =>  20,"C.FA" =>  21,"C.FQ" =>  22,"C.Fg" =>  23,"C.Fw" =>  24,
	"C.GA" =>  25,"C.GQ" =>  26,"C.Gg" =>  27,"C.Gw" =>  28,"C.HA" =>  29,"C.HQ" =>  30,"C.Hg" =>  31,"C.Hw" =>  32,"C.JA" =>  33,
	);
    
    local(%trans_xblock) = (
	'AA' => 'A', 'AB' => 'B', 'AQ' => 'A', 'AR' => 'B', 'Ag' => 'A', 'Ah' => 'B', 'Aw' => 'A', 'Ax' => 'B',
	'BA' => 'A', 'BB' => 'B', 'BQ' => 'A', 'BR' => 'B', 'Bg' => 'A', 'Bh' => 'B', 'Bw' => 'A', 'Bx' => 'B',
	'CA' => 'A', 'CB' => 'B', 'CQ' => 'A', 'CR' => 'B', 'Cg' => 'A', 'Ch' => 'B', 'Cw' => 'A', 'Cx' => 'B',
	'DA' => 'A', 'DB' => 'B', 'DQ' => 'A', 'DR' => 'B', 'Dg' => 'A', 'Dh' => 'B', 'Dw' => 'A', 'Dx' => 'B',
	'EA' => 'A', 'EB' => 'B', 'EQ' => 'A', 'ER' => 'B', 'Eg' => 'A', 'Eh' => 'B', 'Ew' => 'A', 'Ex' => 'B',
	'FA' => 'A', 'FB' => 'B', 'FQ' => 'A', 'FR' => 'B', 'Fg' => 'A', 'Fh' => 'B', 'Fw' => 'A', 'Fx' => 'B',
	'GA' => 'A', 'GB' => 'B', 'GQ' => 'A', 'GR' => 'B', 'Gg' => 'A', 'Gh' => 'B', 'Gw' => 'A', 'Gx' => 'B',
	'HA' => 'A', 'HB' => 'B', 'HQ' => 'A', 'HR' => 'B', 'Hg' => 'A', 'Hh' => 'B', 'Hw' => 'A', 'Hx' => 'B',
	'IA' => 'A', 'IB' => 'B', 'IQ' => 'A', 'IR' => 'B', 'Ig' => 'A', 'Ih' => 'B', 'Iw' => 'A', 'Ix' => 'B',
	'JA' => 'A', 'JB' => 'B', 'JQ' => 'A', 'JR' => 'B', 'Jg' => 'A', 'Jh' => 'B', 'Jw' => 'A', 'Jx' => 'B',
	'KA' => 'A', 'KB' => 'B', 'KQ' => 'A', 'KR' => 'B', 'Kg' => 'A', 'Kh' => 'B', 'Kw' => 'A', 'Kx' => 'B',
	'LA' => 'A', 'LB' => 'B', 'LQ' => 'A', 'LR' => 'B', 'Lg' => 'A', 'Lh' => 'B', 'Lw' => 'A', 'Lx' => 'B',
	);
    
    local(%trans_yblock) = (
	'Q' => 0, 'R' => 1, 'S' => 2,
	'g' => 0, 'h' => 1, 'i' => 2,
	'w' => 0, 'x' => 1, 'y' => 2,
	'A' => 0, 'B' => 1, 'C' => 2,
	);
    
    my($code) = "x"; #empty maze
    if($url =~ /\bdata=([A-Za-z0-9]+)/) {
        my($data) = $1;
        while($data =~ s/^(.{6})(.{5})(.{5})// || $data =~ s/^(.{6})(.{5})?(.{5})?$//) {
            my($chunk1,$chunk2,$chunk3) = ($1,$2,$3);
            my($tower,$x,$y) = translate($chunk1,1);
            $code .= "$tower"."x$x"."x$y"."x";
            if($chunk2) {
                my($tower,$x,$y) = translate(substr($chunk1,-1,1).$chunk2,2);
                $code .= "$tower"."x$x"."x$y"."x";
            }
            if($chunk3) {
                my($tower,$x,$y) = translate($chunk3,3);
                $code .= "$tower"."x$x"."x$y"."x";
            }
        }
    }
    return $code;
}

sub translate {
    my($txt,$type) = @_;
    my($c,$y,$x,$z,$t);
    my($y2,$x2,$z2,$t2);
    my($y3,$x3,$z3,$t3);
    
    if($type == 1) { ($x,$y,$z,$t) = unpack("A2A1A1A2",$txt); $y2 = "A.$trans_xblock{$x}.$y"; $x2 = "A.$x"; $t2 = "A.$t"; }
    elsif($type == 2) { ($c,$x,$y,$z,$t) = unpack("A1A1A1A1A2",$txt); $y2 = "B.$y"; $x2 = "B.$trans_yblock{$c}.$x"; $t2 = "B.$t"; }
    elsif($type == 3) { ($x,$y,$z,$t) = unpack("A1A2A1A1",$txt); $y2 = "C.$y"; $x2 = "C.$x"; $t2 = "C.$t"; }
    
    my($tower) = defined($trans_tower{$t2}) ? $trans_tower{$t2} : "?$t?";
    $x3 = $trans_x{$x2};
    $y3 = $trans_y{$y2};
    return($tower,$x3,$y3);
}

sub get_monsters {
    my($rank,$ids) = @_;
    my(%monsters) = (
	1 => { 7=>{'s'=>0.55,'h'=>54,}, 6=>{'s'=>0.60,'h'=>57,}, 5=>{'s'=>0.65,'h'=>60,}, 4=>{'s'=>0.70,'h'=>63,}, 3=>{'s'=>0.75,'h'=>66,}, 2=>{'s'=>0.80,'h'=>69,}, 1=>{'s'=>0.85,'h'=>72,}, 0=>{'s'=>0.90,'h'=>75,},   },
	2 => { 7=>{'s'=>0.55,'h'=>94,}, 6=>{'s'=>0.60,'h'=>97,}, 5=>{'s'=>0.65,'h'=>100,}, 4=>{'s'=>0.70,'h'=>103,}, 3=>{'s'=>0.75,'h'=>106,}, 2=>{'s'=>0.80,'h'=>109,}, 1=>{'s'=>0.85,'h'=>112,}, 0=>{'s'=>0.90,'h'=>115,},   },
	3 => { 7=>{'s'=>0.55,'h'=>790,}, 6=>{'s'=>0.60,'h'=>860,}, 5=>{'s'=>0.65,'h'=>930,}, 4=>{'s'=>0.70,'h'=>1000,}, 3=>{'s'=>0.75,'h'=>1070,}, 2=>{'s'=>0.80,'h'=>1140,}, 1=>{'s'=>0.85,'h'=>1210,}, 0=>{'s'=>0.90,'h'=>1280,},   },
	4 => { 7=>{'s'=>0.55,'h'=>56,}, 6=>{'s'=>0.60,'h'=>58,}, 5=>{'s'=>0.65,'h'=>60,}, 4=>{'s'=>0.70,'h'=>62,}, 3=>{'s'=>0.75,'h'=>64,}, 2=>{'s'=>0.80,'h'=>66,}, 1=>{'s'=>0.85,'h'=>68,}, 0=>{'s'=>0.90,'h'=>70,},   },
	5 => { 7=>{'s'=>0.55,'h'=>144,}, 6=>{'s'=>0.60,'h'=>152,}, 5=>{'s'=>0.65,'h'=>160,}, 4=>{'s'=>0.70,'h'=>168,}, 3=>{'s'=>0.75,'h'=>176,}, 2=>{'s'=>0.80,'h'=>184,}, 1=>{'s'=>0.85,'h'=>192,}, 0=>{'s'=>0.90,'h'=>200,},   },
	6 => { 7=>{'s'=>0.55,'h'=>425,}, 6=>{'s'=>0.60,'h'=>450,}, 5=>{'s'=>0.65,'h'=>475,}, 4=>{'s'=>0.70,'h'=>500,}, 3=>{'s'=>0.75,'h'=>525,}, 2=>{'s'=>0.80,'h'=>550,}, 1=>{'s'=>0.85,'h'=>575,}, 0=>{'s'=>0.90,'h'=>600,},   },
	7 => { 7=>{'s'=>0.55,'h'=>36,}, 6=>{'s'=>0.60,'h'=>38,}, 5=>{'s'=>0.65,'h'=>40,}, 4=>{'s'=>0.70,'h'=>42,}, 3=>{'s'=>0.75,'h'=>44,}, 2=>{'s'=>0.80,'h'=>46,}, 1=>{'s'=>0.85,'h'=>48,}, 0=>{'s'=>0.90,'h'=>50,},   },
	8 => { 7=>{'s'=>0.55,'h'=>598,}, 6=>{'s'=>0.60,'h'=>634,}, 5=>{'s'=>0.65,'h'=>670,}, 4=>{'s'=>0.70,'h'=>706,}, 3=>{'s'=>0.75,'h'=>742,}, 2=>{'s'=>0.80,'h'=>778,}, 1=>{'s'=>0.85,'h'=>814,}, 0=>{'s'=>0.90,'h'=>850,},   },
	9 => { 7=>{'s'=>0.55,'h'=>8390,}, 6=>{'s'=>0.60,'h'=>8820,}, 5=>{'s'=>0.65,'h'=>9250,}, 4=>{'s'=>0.70,'h'=>9680,}, 3=>{'s'=>0.75,'h'=>10110,}, 2=>{'s'=>0.80,'h'=>10540,}, 1=>{'s'=>0.85,'h'=>10970,}, 0=>{'s'=>0.90,'h'=>11400,},   },
	10 => { 7=>{'s'=>0.55,'h'=>565,}, 6=>{'s'=>0.60,'h'=>615,}, 5=>{'s'=>0.65,'h'=>665,}, 4=>{'s'=>0.70,'h'=>715,}, 3=>{'s'=>0.75,'h'=>765,}, 2=>{'s'=>0.80,'h'=>815,}, 1=>{'s'=>0.85,'h'=>865,}, 0=>{'s'=>0.90,'h'=>915,},   },
	11 => { 7=>{'s'=>0.72,'h'=>6370,}, 6=>{'s'=>0.76,'h'=>6700,}, 5=>{'s'=>0.80,'h'=>7030,}, 4=>{'s'=>0.84,'h'=>7360,}, 3=>{'s'=>0.88,'h'=>7690,}, 2=>{'s'=>0.92,'h'=>8020,}, 1=>{'s'=>0.96,'h'=>8350,}, 0=>{'s'=>1.00,'h'=>8680,},   },
	12 => { 7=>{'s'=>0.72,'h'=>1065,}, 6=>{'s'=>0.76,'h'=>1125,}, 5=>{'s'=>0.80,'h'=>1185,}, 4=>{'s'=>0.84,'h'=>1245,}, 3=>{'s'=>0.88,'h'=>1305,}, 2=>{'s'=>0.92,'h'=>1365,}, 1=>{'s'=>0.96,'h'=>1425,}, 0=>{'s'=>1.00,'h'=>1485,},   },
	13 => { 7=>{'s'=>0.72,'h'=>3245,}, 6=>{'s'=>0.76,'h'=>3530,}, 5=>{'s'=>0.80,'h'=>3815,}, 4=>{'s'=>0.84,'h'=>4100,}, 3=>{'s'=>0.88,'h'=>4385,}, 2=>{'s'=>0.92,'h'=>4670,}, 1=>{'s'=>0.96,'h'=>4955,}, 0=>{'s'=>1.00,'h'=>5240,},   },
	14 => { 7=>{'s'=>0.72,'h'=>128,}, 6=>{'s'=>0.76,'h'=>134,}, 5=>{'s'=>0.80,'h'=>140,}, 4=>{'s'=>0.84,'h'=>146,}, 3=>{'s'=>0.88,'h'=>152,}, 2=>{'s'=>0.92,'h'=>158,}, 1=>{'s'=>0.96,'h'=>164,}, 0=>{'s'=>1.00,'h'=>170,},   },
	15 => { 7=>{'s'=>0.72,'h'=>2297,}, 6=>{'s'=>0.76,'h'=>2421,}, 5=>{'s'=>0.80,'h'=>2545,}, 4=>{'s'=>0.84,'h'=>2669,}, 3=>{'s'=>0.88,'h'=>2793,}, 2=>{'s'=>0.92,'h'=>2917,}, 1=>{'s'=>0.96,'h'=>3041,}, 0=>{'s'=>1.00,'h'=>3165,},   },
	16 => { 7=>{'s'=>0.85,'h'=>116,}, 6=>{'s'=>0.90,'h'=>123,}, 5=>{'s'=>0.95,'h'=>130,}, 4=>{'s'=>1.00,'h'=>137,}, 3=>{'s'=>1.05,'h'=>144,}, 2=>{'s'=>1.10,'h'=>151,}, 1=>{'s'=>1.15,'h'=>158,}, 0=>{'s'=>1.20,'h'=>165,},   },
	17 => { 7=>{'s'=>0.85,'h'=>95,}, 6=>{'s'=>0.90,'h'=>100,}, 5=>{'s'=>0.95,'h'=>105,}, 4=>{'s'=>1.00,'h'=>110,}, 3=>{'s'=>1.05,'h'=>115,}, 2=>{'s'=>1.10,'h'=>120,}, 1=>{'s'=>1.15,'h'=>125,}, 0=>{'s'=>1.20,'h'=>130,},   },
	18 => { 7=>{'s'=>0.85,'h'=>4640,}, 6=>{'s'=>0.90,'h'=>4850,}, 5=>{'s'=>0.95,'h'=>5060,}, 4=>{'s'=>1.00,'h'=>5270,}, 3=>{'s'=>1.05,'h'=>5480,}, 2=>{'s'=>1.10,'h'=>5690,}, 1=>{'s'=>1.15,'h'=>5900,}, 0=>{'s'=>1.20,'h'=>6110,},   },
	19 => { 7=>{'s'=>0.85,'h'=>296,}, 6=>{'s'=>0.90,'h'=>308,}, 5=>{'s'=>0.95,'h'=>320,}, 4=>{'s'=>1.00,'h'=>332,}, 3=>{'s'=>1.05,'h'=>344,}, 2=>{'s'=>1.10,'h'=>356,}, 1=>{'s'=>1.15,'h'=>368,}, 0=>{'s'=>1.20,'h'=>380,},   },
	20 => { 7=>{'s'=>0.85,'h'=>289,}, 6=>{'s'=>0.90,'h'=>307,}, 5=>{'s'=>0.95,'h'=>325,}, 4=>{'s'=>1.00,'h'=>343,}, 3=>{'s'=>1.05,'h'=>361,}, 2=>{'s'=>1.10,'h'=>379,}, 1=>{'s'=>1.15,'h'=>397,}, 0=>{'s'=>1.20,'h'=>415,},   },
	21 => { 7=>{'s'=>0.80,'h'=>1730,}, 6=>{'s'=>0.90,'h'=>1840,}, 5=>{'s'=>1.00,'h'=>1950,}, 4=>{'s'=>1.10,'h'=>2060,}, 3=>{'s'=>1.20,'h'=>2170,}, 2=>{'s'=>1.30,'h'=>2280,}, 1=>{'s'=>1.40,'h'=>2390,}, 0=>{'s'=>1.50,'h'=>2500,},   },
	22 => { 7=>{'s'=>0.80,'h'=>490,}, 6=>{'s'=>0.90,'h'=>520,}, 5=>{'s'=>1.00,'h'=>550,}, 4=>{'s'=>1.10,'h'=>580,}, 3=>{'s'=>1.20,'h'=>610,}, 2=>{'s'=>1.30,'h'=>640,}, 1=>{'s'=>1.40,'h'=>670,}, 0=>{'s'=>1.50,'h'=>700,},   },
	23 => { 7=>{'s'=>0.80,'h'=>2595,}, 6=>{'s'=>0.90,'h'=>2815,}, 5=>{'s'=>1.00,'h'=>3035,}, 4=>{'s'=>1.10,'h'=>3255,}, 3=>{'s'=>1.20,'h'=>3475,}, 2=>{'s'=>1.30,'h'=>3695,}, 1=>{'s'=>1.40,'h'=>3915,}, 0=>{'s'=>1.50,'h'=>4135,},   },
	24 => { 7=>{'s'=>0.94,'h'=>1213,}, 6=>{'s'=>1.02,'h'=>1274,}, 5=>{'s'=>1.10,'h'=>1335,}, 4=>{'s'=>1.18,'h'=>1396,}, 3=>{'s'=>1.26,'h'=>1457,}, 2=>{'s'=>1.34,'h'=>1518,}, 1=>{'s'=>1.42,'h'=>1579,}, 0=>{'s'=>1.50,'h'=>1640,},   },
	25 => { 7=>{'s'=>0.94,'h'=>995,}, 6=>{'s'=>1.02,'h'=>1035,}, 5=>{'s'=>1.10,'h'=>1075,}, 4=>{'s'=>1.18,'h'=>1115,}, 3=>{'s'=>1.26,'h'=>1155,}, 2=>{'s'=>1.34,'h'=>1195,}, 1=>{'s'=>1.42,'h'=>1235,}, 0=>{'s'=>1.50,'h'=>1275,},   },
	26 => { 7=>{'s'=>0.94,'h'=>33,}, 6=>{'s'=>1.02,'h'=>34,}, 5=>{'s'=>1.10,'h'=>35,}, 4=>{'s'=>1.18,'h'=>36,}, 3=>{'s'=>1.26,'h'=>37,}, 2=>{'s'=>1.34,'h'=>38,}, 1=>{'s'=>1.42,'h'=>39,}, 0=>{'s'=>1.50,'h'=>40,},   },
	27 => { 7=>{'s'=>0.94,'h'=>742,}, 6=>{'s'=>1.02,'h'=>766,}, 5=>{'s'=>1.10,'h'=>790,}, 4=>{'s'=>1.18,'h'=>814,}, 3=>{'s'=>1.26,'h'=>838,}, 2=>{'s'=>1.34,'h'=>862,}, 1=>{'s'=>1.42,'h'=>886,}, 0=>{'s'=>1.50,'h'=>910,},   },
	28 => { 7=>{'s'=>0.98,'h'=>90,}, 6=>{'s'=>1.09,'h'=>95,}, 5=>{'s'=>1.20,'h'=>100,}, 4=>{'s'=>1.31,'h'=>105,}, 3=>{'s'=>1.42,'h'=>110,}, 2=>{'s'=>1.53,'h'=>115,}, 1=>{'s'=>1.64,'h'=>120,}, 0=>{'s'=>1.75,'h'=>125,},   },
	29 => { 7=>{'s'=>0.98,'h'=>1128,}, 6=>{'s'=>1.09,'h'=>1204,}, 5=>{'s'=>1.20,'h'=>1280,}, 4=>{'s'=>1.31,'h'=>1356,}, 3=>{'s'=>1.42,'h'=>1432,}, 2=>{'s'=>1.53,'h'=>1508,}, 1=>{'s'=>1.64,'h'=>1584,}, 0=>{'s'=>1.75,'h'=>1660,},   },
	30 => { 7=>{'s'=>0.98,'h'=>4140,}, 6=>{'s'=>1.09,'h'=>4320,}, 5=>{'s'=>1.20,'h'=>4500,}, 4=>{'s'=>1.31,'h'=>4680,}, 3=>{'s'=>1.42,'h'=>4860,}, 2=>{'s'=>1.53,'h'=>5040,}, 1=>{'s'=>1.64,'h'=>5220,}, 0=>{'s'=>1.75,'h'=>5400,},   },
	31 => { 7=>{'s'=>0.98,'h'=>2385,}, 6=>{'s'=>1.09,'h'=>2510,}, 5=>{'s'=>1.20,'h'=>2635,}, 4=>{'s'=>1.31,'h'=>2760,}, 3=>{'s'=>1.42,'h'=>2885,}, 2=>{'s'=>1.53,'h'=>3010,}, 1=>{'s'=>1.64,'h'=>3135,}, 0=>{'s'=>1.75,'h'=>3260,},   },
	32 => { 7=>{'s'=>0.82,'h'=>26,}, 6=>{'s'=>0.96,'h'=>28,}, 5=>{'s'=>1.10,'h'=>30,}, 4=>{'s'=>1.24,'h'=>32,}, 3=>{'s'=>1.38,'h'=>34,}, 2=>{'s'=>1.52,'h'=>36,}, 1=>{'s'=>1.66,'h'=>38,}, 0=>{'s'=>1.80,'h'=>40,},   },
	33 => { 7=>{'s'=>0.82,'h'=>10750,}, 6=>{'s'=>0.96,'h'=>11450,}, 5=>{'s'=>1.10,'h'=>12150,}, 4=>{'s'=>1.24,'h'=>12850,}, 3=>{'s'=>1.38,'h'=>13550,}, 2=>{'s'=>1.52,'h'=>14250,}, 1=>{'s'=>1.66,'h'=>14950,}, 0=>{'s'=>1.80,'h'=>15650,},   },
	34 => { 7=>{'s'=>0.82,'h'=>12650,}, 6=>{'s'=>0.96,'h'=>12900,}, 5=>{'s'=>1.10,'h'=>13150,}, 4=>{'s'=>1.24,'h'=>13400,}, 3=>{'s'=>1.38,'h'=>13650,}, 2=>{'s'=>1.52,'h'=>13900,}, 1=>{'s'=>1.66,'h'=>14150,}, 0=>{'s'=>1.80,'h'=>14400,},   },
	35 => { 7=>{'s'=>0.82,'h'=>1317,}, 6=>{'s'=>0.96,'h'=>1402,}, 5=>{'s'=>1.10,'h'=>1487,}, 4=>{'s'=>1.24,'h'=>1572,}, 3=>{'s'=>1.38,'h'=>1657,}, 2=>{'s'=>1.52,'h'=>1742,}, 1=>{'s'=>1.66,'h'=>1827,}, 0=>{'s'=>1.80,'h'=>1912,},   },
	36 => { 7=>{'s'=>0.82,'h'=>1105,}, 6=>{'s'=>0.96,'h'=>1160,}, 5=>{'s'=>1.10,'h'=>1215,}, 4=>{'s'=>1.24,'h'=>1270,}, 3=>{'s'=>1.38,'h'=>1325,}, 2=>{'s'=>1.52,'h'=>1380,}, 1=>{'s'=>1.66,'h'=>1435,}, 0=>{'s'=>1.80,'h'=>1490,},   },
	37 => { 7=>{'s'=>1.56,'h'=>8740,}, 6=>{'s'=>1.63,'h'=>9150,}, 5=>{'s'=>1.70,'h'=>9560,}, 4=>{'s'=>1.77,'h'=>9970,}, 3=>{'s'=>1.84,'h'=>10380,}, 2=>{'s'=>1.91,'h'=>10790,}, 1=>{'s'=>1.98,'h'=>11200,}, 0=>{'s'=>2.05,'h'=>11610,},   },
	38 => { 7=>{'s'=>1.56,'h'=>2495,}, 6=>{'s'=>1.63,'h'=>2610,}, 5=>{'s'=>1.70,'h'=>2725,}, 4=>{'s'=>1.77,'h'=>2840,}, 3=>{'s'=>1.84,'h'=>2955,}, 2=>{'s'=>1.91,'h'=>3070,}, 1=>{'s'=>1.98,'h'=>3185,}, 0=>{'s'=>2.05,'h'=>3300,},   },
	39 => { 7=>{'s'=>1.56,'h'=>97,}, 6=>{'s'=>1.63,'h'=>106,}, 5=>{'s'=>1.70,'h'=>115,}, 4=>{'s'=>1.77,'h'=>124,}, 3=>{'s'=>1.84,'h'=>133,}, 2=>{'s'=>1.91,'h'=>142,}, 1=>{'s'=>1.98,'h'=>151,}, 0=>{'s'=>2.05,'h'=>160,},   },
	40 => { 7=>{'s'=>1.56,'h'=>87,}, 6=>{'s'=>1.63,'h'=>91,}, 5=>{'s'=>1.70,'h'=>95,}, 4=>{'s'=>1.77,'h'=>99,}, 3=>{'s'=>1.84,'h'=>103,}, 2=>{'s'=>1.91,'h'=>107,}, 1=>{'s'=>1.98,'h'=>111,}, 0=>{'s'=>2.05,'h'=>115,},   },
	41 => { 7=>{'s'=>1.36,'h'=>41,}, 6=>{'s'=>1.48,'h'=>43,}, 5=>{'s'=>1.60,'h'=>45,}, 4=>{'s'=>1.72,'h'=>47,}, 3=>{'s'=>1.84,'h'=>49,}, 2=>{'s'=>1.96,'h'=>51,}, 1=>{'s'=>2.08,'h'=>53,}, 0=>{'s'=>2.20,'h'=>55,},   },
	42 => { 7=>{'s'=>1.36,'h'=>28,}, 6=>{'s'=>1.48,'h'=>29,}, 5=>{'s'=>1.60,'h'=>30,}, 4=>{'s'=>1.72,'h'=>31,}, 3=>{'s'=>1.84,'h'=>32,}, 2=>{'s'=>1.96,'h'=>33,}, 1=>{'s'=>2.08,'h'=>34,}, 0=>{'s'=>2.20,'h'=>35,},   },
	43 => { 7=>{'s'=>1.36,'h'=>5320,}, 6=>{'s'=>1.48,'h'=>5760,}, 5=>{'s'=>1.60,'h'=>6200,}, 4=>{'s'=>1.72,'h'=>6640,}, 3=>{'s'=>1.84,'h'=>7080,}, 2=>{'s'=>1.96,'h'=>7520,}, 1=>{'s'=>2.08,'h'=>7960,}, 0=>{'s'=>2.20,'h'=>8400,},   },
	44 => { 7=>{'s'=>1.70,'h'=>46,}, 6=>{'s'=>1.80,'h'=>48,}, 5=>{'s'=>1.90,'h'=>50,}, 4=>{'s'=>2.00,'h'=>52,}, 3=>{'s'=>2.10,'h'=>54,}, 2=>{'s'=>2.20,'h'=>56,}, 1=>{'s'=>2.30,'h'=>58,}, 0=>{'s'=>2.40,'h'=>60,},   },
	45 => { 7=>{'s'=>1.70,'h'=>520,}, 6=>{'s'=>1.80,'h'=>550,}, 5=>{'s'=>1.90,'h'=>580,}, 4=>{'s'=>2.00,'h'=>610,}, 3=>{'s'=>2.10,'h'=>640,}, 2=>{'s'=>2.20,'h'=>670,}, 1=>{'s'=>2.30,'h'=>700,}, 0=>{'s'=>2.40,'h'=>730,},   },
	46 => { 7=>{'s'=>1.70,'h'=>73,}, 6=>{'s'=>1.80,'h'=>79,}, 5=>{'s'=>1.90,'h'=>85,}, 4=>{'s'=>2.00,'h'=>91,}, 3=>{'s'=>2.10,'h'=>97,}, 2=>{'s'=>2.20,'h'=>103,}, 1=>{'s'=>2.30,'h'=>109,}, 0=>{'s'=>2.40,'h'=>115,},   },
	47 => { 7=>{'s'=>1.70,'h'=>133,}, 6=>{'s'=>1.80,'h'=>139,}, 5=>{'s'=>1.90,'h'=>145,}, 4=>{'s'=>2.00,'h'=>151,}, 3=>{'s'=>2.10,'h'=>157,}, 2=>{'s'=>2.20,'h'=>163,}, 1=>{'s'=>2.30,'h'=>169,}, 0=>{'s'=>2.40,'h'=>175,},   },
	48 => { 7=>{'s'=>1.70,'h'=>172,}, 6=>{'s'=>1.80,'h'=>186,}, 5=>{'s'=>1.90,'h'=>200,}, 4=>{'s'=>2.00,'h'=>214,}, 3=>{'s'=>2.10,'h'=>228,}, 2=>{'s'=>2.20,'h'=>242,}, 1=>{'s'=>2.30,'h'=>256,}, 0=>{'s'=>2.40,'h'=>270,},   },
	49 => { 7=>{'s'=>1.70,'h'=>13,}, 6=>{'s'=>1.80,'h'=>14,}, 5=>{'s'=>1.90,'h'=>15,}, 4=>{'s'=>2.00,'h'=>16,}, 3=>{'s'=>2.10,'h'=>17,}, 2=>{'s'=>2.20,'h'=>18,}, 1=>{'s'=>2.30,'h'=>19,}, 0=>{'s'=>2.40,'h'=>20,},   },
	50 => { 7=>{'s'=>1.55,'h'=>2230,}, 6=>{'s'=>1.70,'h'=>2350,}, 5=>{'s'=>1.85,'h'=>2470,}, 4=>{'s'=>2.00,'h'=>2590,}, 3=>{'s'=>2.15,'h'=>2710,}, 2=>{'s'=>2.30,'h'=>2830,}, 1=>{'s'=>2.45,'h'=>2950,}, 0=>{'s'=>2.60,'h'=>3070,},   },
	51 => { 7=>{'s'=>1.55,'h'=>186,}, 6=>{'s'=>1.70,'h'=>198,}, 5=>{'s'=>1.85,'h'=>210,}, 4=>{'s'=>2.00,'h'=>222,}, 3=>{'s'=>2.15,'h'=>234,}, 2=>{'s'=>2.30,'h'=>246,}, 1=>{'s'=>2.45,'h'=>258,}, 0=>{'s'=>2.60,'h'=>270,},   },
	52 => { 7=>{'s'=>1.55,'h'=>10780,}, 6=>{'s'=>1.70,'h'=>11240,}, 5=>{'s'=>1.85,'h'=>11700,}, 4=>{'s'=>2.00,'h'=>12160,}, 3=>{'s'=>2.15,'h'=>12620,}, 2=>{'s'=>2.30,'h'=>13080,}, 1=>{'s'=>2.45,'h'=>13540,}, 0=>{'s'=>2.60,'h'=>14000,},   },
	53 => { 7=>{'s'=>1.55,'h'=>3210,}, 6=>{'s'=>1.70,'h'=>3480,}, 5=>{'s'=>1.85,'h'=>3750,}, 4=>{'s'=>2.00,'h'=>4020,}, 3=>{'s'=>2.15,'h'=>4290,}, 2=>{'s'=>2.30,'h'=>4560,}, 1=>{'s'=>2.45,'h'=>4830,}, 0=>{'s'=>2.60,'h'=>5100,},   },
	54 => { 7=>{'s'=>1.94,'h'=>1235,}, 6=>{'s'=>2.07,'h'=>1300,}, 5=>{'s'=>2.20,'h'=>1365,}, 4=>{'s'=>2.33,'h'=>1430,}, 3=>{'s'=>2.46,'h'=>1495,}, 2=>{'s'=>2.59,'h'=>1560,}, 1=>{'s'=>2.72,'h'=>1625,}, 0=>{'s'=>2.85,'h'=>1690,},   },
	55 => { 7=>{'s'=>1.94,'h'=>280,}, 6=>{'s'=>2.07,'h'=>285,}, 5=>{'s'=>2.20,'h'=>290,}, 4=>{'s'=>2.33,'h'=>295,}, 3=>{'s'=>2.46,'h'=>300,}, 2=>{'s'=>2.59,'h'=>305,}, 1=>{'s'=>2.72,'h'=>310,}, 0=>{'s'=>2.85,'h'=>315,},   },
	56 => { 7=>{'s'=>1.94,'h'=>8,}, 6=>{'s'=>2.07,'h'=>9,}, 5=>{'s'=>2.20,'h'=>10,}, 4=>{'s'=>2.33,'h'=>11,}, 3=>{'s'=>2.46,'h'=>12,}, 2=>{'s'=>2.59,'h'=>13,}, 1=>{'s'=>2.72,'h'=>14,}, 0=>{'s'=>2.85,'h'=>15,},   },
	57 => { 7=>{'s'=>1.94,'h'=>62,}, 6=>{'s'=>2.07,'h'=>66,}, 5=>{'s'=>2.20,'h'=>70,}, 4=>{'s'=>2.33,'h'=>74,}, 3=>{'s'=>2.46,'h'=>78,}, 2=>{'s'=>2.59,'h'=>82,}, 1=>{'s'=>2.72,'h'=>86,}, 0=>{'s'=>2.85,'h'=>90,},   },
	58 => { 7=>{'s'=>1.90,'h'=>312,}, 6=>{'s'=>2.05,'h'=>346,}, 5=>{'s'=>2.20,'h'=>380,}, 4=>{'s'=>2.35,'h'=>414,}, 3=>{'s'=>2.50,'h'=>448,}, 2=>{'s'=>2.65,'h'=>482,}, 1=>{'s'=>2.80,'h'=>516,}, 0=>{'s'=>2.95,'h'=>550,},   },
	59 => { 7=>{'s'=>1.90,'h'=>109,}, 6=>{'s'=>2.05,'h'=>122,}, 5=>{'s'=>2.20,'h'=>135,}, 4=>{'s'=>2.35,'h'=>148,}, 3=>{'s'=>2.50,'h'=>161,}, 2=>{'s'=>2.65,'h'=>174,}, 1=>{'s'=>2.80,'h'=>187,}, 0=>{'s'=>2.95,'h'=>200,},   },
	60 => { 7=>{'s'=>1.90,'h'=>3730,}, 6=>{'s'=>2.05,'h'=>4020,}, 5=>{'s'=>2.20,'h'=>4310,}, 4=>{'s'=>2.35,'h'=>4600,}, 3=>{'s'=>2.50,'h'=>4890,}, 2=>{'s'=>2.65,'h'=>5180,}, 1=>{'s'=>2.80,'h'=>5470,}, 0=>{'s'=>2.95,'h'=>5760,},   },
	61 => { 7=>{'s'=>1.90,'h'=>6490,}, 6=>{'s'=>2.05,'h'=>6620,}, 5=>{'s'=>2.20,'h'=>6750,}, 4=>{'s'=>2.35,'h'=>6880,}, 3=>{'s'=>2.50,'h'=>7010,}, 2=>{'s'=>2.65,'h'=>7140,}, 1=>{'s'=>2.80,'h'=>7270,}, 0=>{'s'=>2.95,'h'=>7400,},   },
	62 => { 7=>{'s'=>1.90,'h'=>7440,}, 6=>{'s'=>2.05,'h'=>7860,}, 5=>{'s'=>2.20,'h'=>8280,}, 4=>{'s'=>2.35,'h'=>8700,}, 3=>{'s'=>2.50,'h'=>9120,}, 2=>{'s'=>2.65,'h'=>9540,}, 1=>{'s'=>2.80,'h'=>9960,}, 0=>{'s'=>2.95,'h'=>10380,},   },
	63 => { 7=>{'s'=>1.44,'h'=>28,}, 6=>{'s'=>1.67,'h'=>29,}, 5=>{'s'=>1.90,'h'=>30,}, 4=>{'s'=>2.13,'h'=>31,}, 3=>{'s'=>2.36,'h'=>32,}, 2=>{'s'=>2.59,'h'=>33,}, 1=>{'s'=>2.82,'h'=>34,}, 0=>{'s'=>3.05,'h'=>35,},   },
	64 => { 7=>{'s'=>1.44,'h'=>9630,}, 6=>{'s'=>1.67,'h'=>10440,}, 5=>{'s'=>1.90,'h'=>11250,}, 4=>{'s'=>2.13,'h'=>12060,}, 3=>{'s'=>2.36,'h'=>12870,}, 2=>{'s'=>2.59,'h'=>13680,}, 1=>{'s'=>2.82,'h'=>14490,}, 0=>{'s'=>3.05,'h'=>15300,},   },
	65 => { 7=>{'s'=>1.44,'h'=>23,}, 6=>{'s'=>1.67,'h'=>24,}, 5=>{'s'=>1.90,'h'=>25,}, 4=>{'s'=>2.13,'h'=>26,}, 3=>{'s'=>2.36,'h'=>27,}, 2=>{'s'=>2.59,'h'=>28,}, 1=>{'s'=>2.82,'h'=>29,}, 0=>{'s'=>3.05,'h'=>30,},   },
	66 => { 7=>{'s'=>1.84,'h'=>252,}, 6=>{'s'=>2.02,'h'=>261,}, 5=>{'s'=>2.20,'h'=>270,}, 4=>{'s'=>2.38,'h'=>279,}, 3=>{'s'=>2.56,'h'=>288,}, 2=>{'s'=>2.74,'h'=>297,}, 1=>{'s'=>2.92,'h'=>306,}, 0=>{'s'=>3.10,'h'=>315,},   },
	67 => { 7=>{'s'=>1.84,'h'=>90,}, 6=>{'s'=>2.02,'h'=>95,}, 5=>{'s'=>2.20,'h'=>100,}, 4=>{'s'=>2.38,'h'=>105,}, 3=>{'s'=>2.56,'h'=>110,}, 2=>{'s'=>2.74,'h'=>115,}, 1=>{'s'=>2.92,'h'=>120,}, 0=>{'s'=>3.10,'h'=>125,},   },
	68 => { 7=>{'s'=>1.84,'h'=>23,}, 6=>{'s'=>2.02,'h'=>24,}, 5=>{'s'=>2.20,'h'=>25,}, 4=>{'s'=>2.38,'h'=>26,}, 3=>{'s'=>2.56,'h'=>27,}, 2=>{'s'=>2.74,'h'=>28,}, 1=>{'s'=>2.92,'h'=>29,}, 0=>{'s'=>3.10,'h'=>30,},   },
	69 => { 7=>{'s'=>1.71,'h'=>33,}, 6=>{'s'=>1.93,'h'=>34,}, 5=>{'s'=>2.15,'h'=>35,}, 4=>{'s'=>2.37,'h'=>36,}, 3=>{'s'=>2.59,'h'=>37,}, 2=>{'s'=>2.81,'h'=>38,}, 1=>{'s'=>3.03,'h'=>39,}, 0=>{'s'=>3.25,'h'=>40,},   },
	70 => { 7=>{'s'=>1.71,'h'=>7,}, 6=>{'s'=>1.93,'h'=>8,}, 5=>{'s'=>2.15,'h'=>9,}, 4=>{'s'=>2.37,'h'=>10,}, 3=>{'s'=>2.59,'h'=>11,}, 2=>{'s'=>2.81,'h'=>12,}, 1=>{'s'=>3.03,'h'=>13,}, 0=>{'s'=>3.25,'h'=>14,},   },
	71 => { 7=>{'s'=>1.71,'h'=>62,}, 6=>{'s'=>1.93,'h'=>66,}, 5=>{'s'=>2.15,'h'=>70,}, 4=>{'s'=>2.37,'h'=>74,}, 3=>{'s'=>2.59,'h'=>78,}, 2=>{'s'=>2.81,'h'=>82,}, 1=>{'s'=>3.03,'h'=>86,}, 0=>{'s'=>3.25,'h'=>90,},   },
	72 => { 7=>{'s'=>1.87,'h'=>217,}, 6=>{'s'=>2.11,'h'=>236,}, 5=>{'s'=>2.35,'h'=>255,}, 4=>{'s'=>2.59,'h'=>274,}, 3=>{'s'=>2.83,'h'=>293,}, 2=>{'s'=>3.07,'h'=>312,}, 1=>{'s'=>3.31,'h'=>331,}, 0=>{'s'=>3.55,'h'=>350,},   },
	73 => { 7=>{'s'=>1.87,'h'=>436,}, 6=>{'s'=>2.11,'h'=>458,}, 5=>{'s'=>2.35,'h'=>480,}, 4=>{'s'=>2.59,'h'=>502,}, 3=>{'s'=>2.83,'h'=>524,}, 2=>{'s'=>3.07,'h'=>546,}, 1=>{'s'=>3.31,'h'=>568,}, 0=>{'s'=>3.55,'h'=>590,},   },
	74 => { 7=>{'s'=>1.87,'h'=>2580,}, 6=>{'s'=>2.11,'h'=>2790,}, 5=>{'s'=>2.35,'h'=>3000,}, 4=>{'s'=>2.59,'h'=>3210,}, 3=>{'s'=>2.83,'h'=>3420,}, 2=>{'s'=>3.07,'h'=>3630,}, 1=>{'s'=>3.31,'h'=>3840,}, 0=>{'s'=>3.55,'h'=>4050,},   },
	75 => { 7=>{'s'=>1.87,'h'=>8790,}, 6=>{'s'=>2.11,'h'=>9120,}, 5=>{'s'=>2.35,'h'=>9450,}, 4=>{'s'=>2.59,'h'=>9780,}, 3=>{'s'=>2.83,'h'=>10110,}, 2=>{'s'=>3.07,'h'=>10440,}, 1=>{'s'=>3.31,'h'=>10770,}, 0=>{'s'=>3.55,'h'=>11100,},   },
	76 => { 7=>{'s'=>1.87,'h'=>1005,}, 6=>{'s'=>2.11,'h'=>1040,}, 5=>{'s'=>2.35,'h'=>1075,}, 4=>{'s'=>2.59,'h'=>1110,}, 3=>{'s'=>2.83,'h'=>1145,}, 2=>{'s'=>3.07,'h'=>1180,}, 1=>{'s'=>3.31,'h'=>1215,}, 0=>{'s'=>3.55,'h'=>1250,},   },
	77 => { 7=>{'s'=>1.87,'h'=>2275,}, 6=>{'s'=>2.11,'h'=>2400,}, 5=>{'s'=>2.35,'h'=>2525,}, 4=>{'s'=>2.59,'h'=>2650,}, 3=>{'s'=>2.83,'h'=>2775,}, 2=>{'s'=>3.07,'h'=>2900,}, 1=>{'s'=>3.31,'h'=>3025,}, 0=>{'s'=>3.55,'h'=>3150,},   },
	78 => { 7=>{'s'=>1.87,'h'=>4160,}, 6=>{'s'=>2.11,'h'=>4380,}, 5=>{'s'=>2.35,'h'=>4600,}, 4=>{'s'=>2.59,'h'=>4820,}, 3=>{'s'=>2.83,'h'=>5040,}, 2=>{'s'=>3.07,'h'=>5260,}, 1=>{'s'=>3.31,'h'=>5480,}, 0=>{'s'=>3.55,'h'=>5700,},   },
	79 => { 7=>{'s'=>1.86,'h'=>2875,}, 6=>{'s'=>2.13,'h'=>3060,}, 5=>{'s'=>2.40,'h'=>3245,}, 4=>{'s'=>2.67,'h'=>3430,}, 3=>{'s'=>2.94,'h'=>3615,}, 2=>{'s'=>3.21,'h'=>3800,}, 1=>{'s'=>3.48,'h'=>3985,}, 0=>{'s'=>3.75,'h'=>4170,},   },
	80 => { 7=>{'s'=>1.86,'h'=>10370,}, 6=>{'s'=>2.13,'h'=>10820,}, 5=>{'s'=>2.40,'h'=>11270,}, 4=>{'s'=>2.67,'h'=>11720,}, 3=>{'s'=>2.94,'h'=>12170,}, 2=>{'s'=>3.21,'h'=>12620,}, 1=>{'s'=>3.48,'h'=>13070,}, 0=>{'s'=>3.75,'h'=>13520,},   },
	81 => { 7=>{'s'=>1.86,'h'=>2470,}, 6=>{'s'=>2.13,'h'=>2580,}, 5=>{'s'=>2.40,'h'=>2690,}, 4=>{'s'=>2.67,'h'=>2800,}, 3=>{'s'=>2.94,'h'=>2910,}, 2=>{'s'=>3.21,'h'=>3020,}, 1=>{'s'=>3.48,'h'=>3130,}, 0=>{'s'=>3.75,'h'=>3240,},   },
	82 => { 7=>{'s'=>1.86,'h'=>960,}, 6=>{'s'=>2.13,'h'=>980,}, 5=>{'s'=>2.40,'h'=>1000,}, 4=>{'s'=>2.67,'h'=>1020,}, 3=>{'s'=>2.94,'h'=>1040,}, 2=>{'s'=>3.21,'h'=>1060,}, 1=>{'s'=>3.48,'h'=>1080,}, 0=>{'s'=>3.75,'h'=>1100,},   },
	83 => { 7=>{'s'=>1.92,'h'=>69,}, 6=>{'s'=>2.21,'h'=>72,}, 5=>{'s'=>2.50,'h'=>75,}, 4=>{'s'=>2.79,'h'=>78,}, 3=>{'s'=>3.08,'h'=>81,}, 2=>{'s'=>3.37,'h'=>84,}, 1=>{'s'=>3.66,'h'=>87,}, 0=>{'s'=>3.95,'h'=>90,},   },
	84 => { 7=>{'s'=>1.92,'h'=>6560,}, 6=>{'s'=>2.21,'h'=>7180,}, 5=>{'s'=>2.50,'h'=>7800,}, 4=>{'s'=>2.79,'h'=>8420,}, 3=>{'s'=>3.08,'h'=>9040,}, 2=>{'s'=>3.37,'h'=>9660,}, 1=>{'s'=>3.66,'h'=>10280,}, 0=>{'s'=>3.95,'h'=>10900,},   },
	85 => { 7=>{'s'=>1.92,'h'=>414,}, 6=>{'s'=>2.21,'h'=>437,}, 5=>{'s'=>2.50,'h'=>460,}, 4=>{'s'=>2.79,'h'=>483,}, 3=>{'s'=>3.08,'h'=>506,}, 2=>{'s'=>3.37,'h'=>529,}, 1=>{'s'=>3.66,'h'=>552,}, 0=>{'s'=>3.95,'h'=>575,},   },
	86 => { 7=>{'s'=>1.92,'h'=>6260,}, 6=>{'s'=>2.21,'h'=>6570,}, 5=>{'s'=>2.50,'h'=>6880,}, 4=>{'s'=>2.79,'h'=>7190,}, 3=>{'s'=>3.08,'h'=>7500,}, 2=>{'s'=>3.37,'h'=>7810,}, 1=>{'s'=>3.66,'h'=>8120,}, 0=>{'s'=>3.95,'h'=>8430,},   },
	91 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	92 => { 7=>{'s'=>0.40,'h'=>58600,}, 6=>{'s'=>0.50,'h'=>71600,}, 5=>{'s'=>0.60,'h'=>84600,}, 4=>{'s'=>0.70,'h'=>97600,}, 3=>{'s'=>0.80,'h'=>110600,}, 2=>{'s'=>0.90,'h'=>123600,}, 1=>{'s'=>1.00,'h'=>136600,}, 0=>{'s'=>1.10,'h'=>149600,},   },
	93 => { 7=>{'s'=>0.40,'h'=>5500000,}, 6=>{'s'=>0.50,'h'=>6500000,}, 5=>{'s'=>0.60,'h'=>7500000,}, 4=>{'s'=>0.70,'h'=>8500000,}, 3=>{'s'=>0.80,'h'=>9500000,}, 2=>{'s'=>0.90,'h'=>10500000,}, 1=>{'s'=>1.00,'h'=>11500000,}, 0=>{'s'=>1.10,'h'=>12500000,},   },
	94 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	95 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>1.10,'h'=>6600000,},   },
	96 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	97 => { 7=>{'s'=>0.62,'h'=>65000,}, 6=>{'s'=>0.76,'h'=>78000,}, 5=>{'s'=>0.90,'h'=>91000,}, 4=>{'s'=>1.04,'h'=>104000,}, 3=>{'s'=>1.18,'h'=>117000,}, 2=>{'s'=>1.32,'h'=>130000,}, 1=>{'s'=>1.46,'h'=>143000,}, 0=>{'s'=>1.60,'h'=>156000,},   },
	98 => { 7=>{'s'=>0.62,'h'=>16200,}, 6=>{'s'=>0.76,'h'=>19700,}, 5=>{'s'=>0.90,'h'=>23200,}, 4=>{'s'=>1.04,'h'=>26700,}, 3=>{'s'=>1.18,'h'=>30200,}, 2=>{'s'=>1.32,'h'=>33700,}, 1=>{'s'=>1.46,'h'=>37200,}, 0=>{'s'=>1.60,'h'=>40700,},   },
	99 => { 7=>{'s'=>0.62,'h'=>150000,}, 6=>{'s'=>0.76,'h'=>185000,}, 5=>{'s'=>0.90,'h'=>220000,}, 4=>{'s'=>1.04,'h'=>255000,}, 3=>{'s'=>1.18,'h'=>290000,}, 2=>{'s'=>1.32,'h'=>325000,}, 1=>{'s'=>1.46,'h'=>360000,}, 0=>{'s'=>1.60,'h'=>395000,},   },
	101 => { 7=>{'s'=>0.54,'h'=>2660000,}, 6=>{'s'=>0.72,'h'=>3230000,}, 5=>{'s'=>0.90,'h'=>3800000,}, 4=>{'s'=>1.08,'h'=>4370000,}, 3=>{'s'=>1.26,'h'=>4940000,}, 2=>{'s'=>1.44,'h'=>5510000,}, 1=>{'s'=>1.62,'h'=>6080000,}, 0=>{'s'=>1.80,'h'=>6650000,},   },
	102 => { 7=>{'s'=>0.54,'h'=>61000,}, 6=>{'s'=>0.72,'h'=>74000,}, 5=>{'s'=>0.90,'h'=>87000,}, 4=>{'s'=>1.08,'h'=>100000,}, 3=>{'s'=>1.26,'h'=>113000,}, 2=>{'s'=>1.44,'h'=>126000,}, 1=>{'s'=>1.62,'h'=>139000,}, 0=>{'s'=>1.80,'h'=>152000,},   },
	103 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	104 => { 7=>{'s'=>0.54,'h'=>210000,}, 6=>{'s'=>0.72,'h'=>250000,}, 5=>{'s'=>0.90,'h'=>290000,}, 4=>{'s'=>1.08,'h'=>330000,}, 3=>{'s'=>1.26,'h'=>370000,}, 2=>{'s'=>1.44,'h'=>410000,}, 1=>{'s'=>1.62,'h'=>450000,}, 0=>{'s'=>1.80,'h'=>490000,},   },
	105 => { 7=>{'s'=>0.54,'h'=>79500,}, 6=>{'s'=>0.72,'h'=>96000,}, 5=>{'s'=>0.90,'h'=>112500,}, 4=>{'s'=>1.08,'h'=>129000,}, 3=>{'s'=>1.26,'h'=>145500,}, 2=>{'s'=>1.44,'h'=>162000,}, 1=>{'s'=>1.62,'h'=>178500,}, 0=>{'s'=>1.80,'h'=>195000,},   },
	106 => { 7=>{'s'=>0.54,'h'=>33250,}, 6=>{'s'=>0.72,'h'=>40500,}, 5=>{'s'=>0.90,'h'=>47750,}, 4=>{'s'=>1.08,'h'=>55000,}, 3=>{'s'=>1.26,'h'=>62250,}, 2=>{'s'=>1.44,'h'=>69500,}, 1=>{'s'=>1.62,'h'=>76750,}, 0=>{'s'=>1.80,'h'=>84000,},   },
	107 => { 7=>{'s'=>0.70,'h'=>277000,}, 6=>{'s'=>0.90,'h'=>337000,}, 5=>{'s'=>1.10,'h'=>397000,}, 4=>{'s'=>1.30,'h'=>457000,}, 3=>{'s'=>1.50,'h'=>517000,}, 2=>{'s'=>1.70,'h'=>577000,}, 1=>{'s'=>1.90,'h'=>637000,}, 0=>{'s'=>2.10,'h'=>697000,},   },
	108 => { 7=>{'s'=>0.70,'h'=>22650,}, 6=>{'s'=>0.90,'h'=>27400,}, 5=>{'s'=>1.10,'h'=>32150,}, 4=>{'s'=>1.30,'h'=>36900,}, 3=>{'s'=>1.50,'h'=>41650,}, 2=>{'s'=>1.70,'h'=>46400,}, 1=>{'s'=>1.90,'h'=>51150,}, 0=>{'s'=>2.10,'h'=>55900,},   },
	109 => { 7=>{'s'=>0.70,'h'=>36200,}, 6=>{'s'=>0.90,'h'=>43200,}, 5=>{'s'=>1.10,'h'=>50200,}, 4=>{'s'=>1.30,'h'=>57200,}, 3=>{'s'=>1.50,'h'=>64200,}, 2=>{'s'=>1.70,'h'=>71200,}, 1=>{'s'=>1.90,'h'=>78200,}, 0=>{'s'=>2.10,'h'=>85200,},   },
	110 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	111 => { 7=>{'s'=>0.69,'h'=>9300,}, 6=>{'s'=>0.92,'h'=>11400,}, 5=>{'s'=>1.15,'h'=>13500,}, 4=>{'s'=>1.38,'h'=>15600,}, 3=>{'s'=>1.61,'h'=>17700,}, 2=>{'s'=>1.84,'h'=>19800,}, 1=>{'s'=>2.07,'h'=>21900,}, 0=>{'s'=>2.30,'h'=>24000,},   },
	112 => { 7=>{'s'=>0.69,'h'=>36000,}, 6=>{'s'=>0.92,'h'=>44000,}, 5=>{'s'=>1.15,'h'=>52000,}, 4=>{'s'=>1.38,'h'=>60000,}, 3=>{'s'=>1.61,'h'=>68000,}, 2=>{'s'=>1.84,'h'=>76000,}, 1=>{'s'=>2.07,'h'=>84000,}, 0=>{'s'=>2.30,'h'=>92000,},   },
	113 => { 7=>{'s'=>0.91,'h'=>14500,}, 6=>{'s'=>1.18,'h'=>17500,}, 5=>{'s'=>1.45,'h'=>20500,}, 4=>{'s'=>1.72,'h'=>23500,}, 3=>{'s'=>1.99,'h'=>26500,}, 2=>{'s'=>2.26,'h'=>29500,}, 1=>{'s'=>2.53,'h'=>32500,}, 0=>{'s'=>2.80,'h'=>35500,},   },
	114 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	115 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	116 => { 7=>{'s'=>0.91,'h'=>21700,}, 6=>{'s'=>1.18,'h'=>25700,}, 5=>{'s'=>1.45,'h'=>29700,}, 4=>{'s'=>1.72,'h'=>33700,}, 3=>{'s'=>1.99,'h'=>37700,}, 2=>{'s'=>2.26,'h'=>41700,}, 1=>{'s'=>2.53,'h'=>45700,}, 0=>{'s'=>2.80,'h'=>49700,},   },
	117 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	118 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	119 => { 7=>{'s'=>1.06,'h'=>115000,}, 6=>{'s'=>1.38,'h'=>140000,}, 5=>{'s'=>1.70,'h'=>165000,}, 4=>{'s'=>2.02,'h'=>190000,}, 3=>{'s'=>2.34,'h'=>215000,}, 2=>{'s'=>2.66,'h'=>240000,}, 1=>{'s'=>2.98,'h'=>265000,}, 0=>{'s'=>3.30,'h'=>290000,},   },
	120 => { 7=>{'s'=>1.06,'h'=>9400,}, 6=>{'s'=>1.38,'h'=>11400,}, 5=>{'s'=>1.70,'h'=>13400,}, 4=>{'s'=>2.02,'h'=>15400,}, 3=>{'s'=>2.34,'h'=>17400,}, 2=>{'s'=>2.66,'h'=>19400,}, 1=>{'s'=>2.98,'h'=>21400,}, 0=>{'s'=>3.30,'h'=>23400,},   },
	121 => { 7=>{'s'=>0.82,'h'=>255000,}, 6=>{'s'=>1.06,'h'=>310000,}, 5=>{'s'=>1.30,'h'=>365000,}, 4=>{'s'=>1.54,'h'=>420000,}, 3=>{'s'=>1.78,'h'=>475000,}, 2=>{'s'=>2.02,'h'=>530000,}, 1=>{'s'=>2.26,'h'=>585000,}, 0=>{'s'=>2.50,'h'=>640000,},   },
	122 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>2.50,'h'=>3150000,},   },
	123 => { 7=>{'s'=>0.82,'h'=>19600,}, 6=>{'s'=>1.06,'h'=>24100,}, 5=>{'s'=>1.30,'h'=>28600,}, 4=>{'s'=>1.54,'h'=>33100,}, 3=>{'s'=>1.78,'h'=>37600,}, 2=>{'s'=>2.02,'h'=>42100,}, 1=>{'s'=>2.26,'h'=>46600,}, 0=>{'s'=>2.50,'h'=>51100,},   },
	124 => { 7=>{'s'=>0.82,'h'=>2710000,}, 6=>{'s'=>1.06,'h'=>3280000,}, 5=>{'s'=>1.30,'h'=>3850000,}, 4=>{'s'=>1.54,'h'=>4420000,}, 3=>{'s'=>1.78,'h'=>4990000,}, 2=>{'s'=>2.02,'h'=>5560000,}, 1=>{'s'=>2.26,'h'=>6130000,}, 0=>{'s'=>2.50,'h'=>6700000,},   },
	126 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	127 => { 7=>{'s'=>0.82,'h'=>115000,}, 6=>{'s'=>1.06,'h'=>145000,}, 5=>{'s'=>1.30,'h'=>175000,}, 4=>{'s'=>1.54,'h'=>205000,}, 3=>{'s'=>1.78,'h'=>235000,}, 2=>{'s'=>2.02,'h'=>265000,}, 1=>{'s'=>2.26,'h'=>295000,}, 0=>{'s'=>2.50,'h'=>325000,},   },
	128 => { 7=>{'s'=>0.82,'h'=>275000,}, 6=>{'s'=>1.06,'h'=>335000,}, 5=>{'s'=>1.30,'h'=>395000,}, 4=>{'s'=>1.54,'h'=>455000,}, 3=>{'s'=>1.78,'h'=>515000,}, 2=>{'s'=>2.02,'h'=>575000,}, 1=>{'s'=>2.26,'h'=>635000,}, 0=>{'s'=>2.50,'h'=>695000,},   },
	129 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>2.50,'h'=>1250000,},   },
	130 => { 7=>{'s'=>1.02,'h'=>105000,}, 6=>{'s'=>1.31,'h'=>125000,}, 5=>{'s'=>1.60,'h'=>145000,}, 4=>{'s'=>1.89,'h'=>165000,}, 3=>{'s'=>2.18,'h'=>185000,}, 2=>{'s'=>2.47,'h'=>205000,}, 1=>{'s'=>2.76,'h'=>225000,}, 0=>{'s'=>3.05,'h'=>245000,},   },
	131 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	132 => { 7=>{'s'=>1.02,'h'=>9200,}, 6=>{'s'=>1.31,'h'=>11200,}, 5=>{'s'=>1.60,'h'=>13200,}, 4=>{'s'=>1.89,'h'=>15200,}, 3=>{'s'=>2.18,'h'=>17200,}, 2=>{'s'=>2.47,'h'=>19200,}, 1=>{'s'=>2.76,'h'=>21200,}, 0=>{'s'=>3.05,'h'=>23200,},   },
	133 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>3.05,'h'=>3050000,},   },
	134 => { 7=>{'s'=>1.02,'h'=>63000,}, 6=>{'s'=>1.31,'h'=>77000,}, 5=>{'s'=>1.60,'h'=>91000,}, 4=>{'s'=>1.89,'h'=>105000,}, 3=>{'s'=>2.18,'h'=>119000,}, 2=>{'s'=>2.47,'h'=>133000,}, 1=>{'s'=>2.76,'h'=>147000,}, 0=>{'s'=>3.05,'h'=>161000,},   },
	135 => { 7=>{'s'=>1.14,'h'=>1840000,}, 6=>{'s'=>1.47,'h'=>2220000,}, 5=>{'s'=>1.80,'h'=>2600000,}, 4=>{'s'=>2.13,'h'=>2980000,}, 3=>{'s'=>2.46,'h'=>3360000,}, 2=>{'s'=>2.79,'h'=>3740000,}, 1=>{'s'=>3.12,'h'=>4120000,}, 0=>{'s'=>3.45,'h'=>4500000,},   },
	136 => { 7=>{'s'=>1.14,'h'=>24700,}, 6=>{'s'=>1.47,'h'=>30700,}, 5=>{'s'=>1.80,'h'=>36700,}, 4=>{'s'=>2.13,'h'=>42700,}, 3=>{'s'=>2.46,'h'=>48700,}, 2=>{'s'=>2.79,'h'=>54700,}, 1=>{'s'=>3.12,'h'=>60700,}, 0=>{'s'=>3.45,'h'=>66700,},   },
	137 => { 7=>{'s'=>1.14,'h'=>2740000,}, 6=>{'s'=>1.47,'h'=>3320000,}, 5=>{'s'=>1.80,'h'=>3900000,}, 4=>{'s'=>2.13,'h'=>4480000,}, 3=>{'s'=>2.46,'h'=>5060000,}, 2=>{'s'=>2.79,'h'=>5640000,}, 1=>{'s'=>3.12,'h'=>6220000,}, 0=>{'s'=>3.45,'h'=>6800000,},   },
	138 => { 7=>{'s'=>1.14,'h'=>341000,}, 6=>{'s'=>1.47,'h'=>411000,}, 5=>{'s'=>1.80,'h'=>481000,}, 4=>{'s'=>2.13,'h'=>551000,}, 3=>{'s'=>2.46,'h'=>621000,}, 2=>{'s'=>2.79,'h'=>691000,}, 1=>{'s'=>3.12,'h'=>761000,}, 0=>{'s'=>3.45,'h'=>831000,},   },
	139 => { 7=>{'s'=>1.14,'h'=>21400,}, 6=>{'s'=>1.47,'h'=>26400,}, 5=>{'s'=>1.80,'h'=>31400,}, 4=>{'s'=>2.13,'h'=>36400,}, 3=>{'s'=>2.46,'h'=>41400,}, 2=>{'s'=>2.79,'h'=>46400,}, 1=>{'s'=>3.12,'h'=>51400,}, 0=>{'s'=>3.45,'h'=>56400,},   },
	140 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	141 => { 7=>{'s'=>1.26,'h'=>60000,}, 6=>{'s'=>1.63,'h'=>73000,}, 5=>{'s'=>2.00,'h'=>86000,}, 4=>{'s'=>2.37,'h'=>99000,}, 3=>{'s'=>2.74,'h'=>112000,}, 2=>{'s'=>3.11,'h'=>125000,}, 1=>{'s'=>3.48,'h'=>138000,}, 0=>{'s'=>3.85,'h'=>151000,},   },
	142 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	143 => { 7=>{'s'=>1.26,'h'=>45000,}, 6=>{'s'=>1.63,'h'=>54000,}, 5=>{'s'=>2.00,'h'=>63000,}, 4=>{'s'=>2.37,'h'=>72000,}, 3=>{'s'=>2.74,'h'=>81000,}, 2=>{'s'=>3.11,'h'=>90000,}, 1=>{'s'=>3.48,'h'=>99000,}, 0=>{'s'=>3.85,'h'=>108000,},   },
	145 => { 7=>{'s'=>1.29,'h'=>2025000,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	146 => { 7=>{'s'=>1.29,'h'=>32600,}, 6=>{'s'=>1.67,'h'=>39600,}, 5=>{'s'=>2.05,'h'=>46600,}, 4=>{'s'=>2.43,'h'=>53600,}, 3=>{'s'=>2.81,'h'=>60600,}, 2=>{'s'=>3.19,'h'=>67600,}, 1=>{'s'=>3.57,'h'=>74600,}, 0=>{'s'=>3.95,'h'=>81600,},   },
	147 => { 7=>{'s'=>1.29,'h'=>1120000,}, 6=>{'s'=>1.67,'h'=>1360000,}, 5=>{'s'=>2.05,'h'=>1600000,}, 4=>{'s'=>2.43,'h'=>1840000,}, 3=>{'s'=>2.81,'h'=>2080000,}, 2=>{'s'=>3.19,'h'=>2320000,}, 1=>{'s'=>3.57,'h'=>2560000,}, 0=>{'s'=>3.95,'h'=>2800000,},   },
	148 => { 7=>{'s'=>1.29,'h'=>54500,}, 6=>{'s'=>1.67,'h'=>66000,}, 5=>{'s'=>2.05,'h'=>77500,}, 4=>{'s'=>2.43,'h'=>89000,}, 3=>{'s'=>2.81,'h'=>100500,}, 2=>{'s'=>3.19,'h'=>112000,}, 1=>{'s'=>3.57,'h'=>123500,}, 0=>{'s'=>3.95,'h'=>135000,},   },
	149 => { 7=>{'s'=>1.29,'h'=>130000,}, 6=>{'s'=>1.67,'h'=>160000,}, 5=>{'s'=>2.05,'h'=>190000,}, 4=>{'s'=>2.43,'h'=>220000,}, 3=>{'s'=>2.81,'h'=>250000,}, 2=>{'s'=>3.19,'h'=>280000,}, 1=>{'s'=>3.57,'h'=>310000,}, 0=>{'s'=>3.95,'h'=>340000,},   },
	150 => { 7=>{'s'=>1.29,'h'=>107500,}, 6=>{'s'=>1.67,'h'=>130000,}, 5=>{'s'=>2.05,'h'=>152500,}, 4=>{'s'=>2.43,'h'=>175000,}, 3=>{'s'=>2.81,'h'=>197500,}, 2=>{'s'=>3.19,'h'=>220000,}, 1=>{'s'=>3.57,'h'=>242500,}, 0=>{'s'=>3.95,'h'=>265000,},   },
	151 => { 7=>{'s'=>1.29,'h'=>265000,}, 6=>{'s'=>1.67,'h'=>315000,}, 5=>{'s'=>2.05,'h'=>365000,}, 4=>{'s'=>2.43,'h'=>415000,}, 3=>{'s'=>2.81,'h'=>465000,}, 2=>{'s'=>3.19,'h'=>515000,}, 1=>{'s'=>3.57,'h'=>565000,}, 0=>{'s'=>3.95,'h'=>615000,},   },
	152 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>4.25,'h'=>1450000,},   },
	153 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	154 => { 7=>{'s'=>1.45,'h'=>64000,}, 6=>{'s'=>1.85,'h'=>78000,}, 5=>{'s'=>2.25,'h'=>92000,}, 4=>{'s'=>2.65,'h'=>106000,}, 3=>{'s'=>3.05,'h'=>120000,}, 2=>{'s'=>3.45,'h'=>134000,}, 1=>{'s'=>3.85,'h'=>148000,}, 0=>{'s'=>4.25,'h'=>162000,},   },
	155 => { 7=>{'s'=>1.45,'h'=>37500,}, 6=>{'s'=>1.85,'h'=>45000,}, 5=>{'s'=>2.25,'h'=>52500,}, 4=>{'s'=>2.65,'h'=>60000,}, 3=>{'s'=>3.05,'h'=>67500,}, 2=>{'s'=>3.45,'h'=>75000,}, 1=>{'s'=>3.85,'h'=>82500,}, 0=>{'s'=>4.25,'h'=>90000,},   },
	156 => { 7=>{'s'=>1.45,'h'=>1640000,}, 6=>{'s'=>1.85,'h'=>2020000,}, 5=>{'s'=>2.25,'h'=>2400000,}, 4=>{'s'=>2.65,'h'=>2780000,}, 3=>{'s'=>3.05,'h'=>3160000,}, 2=>{'s'=>3.45,'h'=>3540000,}, 1=>{'s'=>3.85,'h'=>3920000,}, 0=>{'s'=>4.25,'h'=>4300000,},   },
	157 => { 7=>{'s'=>1.49,'h'=>5600,}, 6=>{'s'=>1.92,'h'=>6700,}, 5=>{'s'=>2.35,'h'=>7800,}, 4=>{'s'=>2.78,'h'=>8900,}, 3=>{'s'=>3.21,'h'=>10000,}, 2=>{'s'=>3.64,'h'=>11100,}, 1=>{'s'=>4.07,'h'=>12200,}, 0=>{'s'=>4.50,'h'=>13300,},   },
	158 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	159 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	160 => { 7=>{'s'=>1.49,'h'=>2000000,}, 6=>{'s'=>1.92,'h'=>2400000,}, 5=>{'s'=>2.35,'h'=>2800000,}, 4=>{'s'=>2.78,'h'=>3200000,}, 3=>{'s'=>3.21,'h'=>3600000,}, 2=>{'s'=>3.64,'h'=>4000000,}, 1=>{'s'=>4.07,'h'=>4400000,}, 0=>{'s'=>4.50,'h'=>4800000,},   },
	161 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>4.50,'h'=>2250000,},   },
	162 => { 7=>{'s'=>1.54,'h'=>225000,}, 6=>{'s'=>2.02,'h'=>270000,}, 5=>{'s'=>2.50,'h'=>315000,}, 4=>{'s'=>2.98,'h'=>360000,}, 3=>{'s'=>3.46,'h'=>405000,}, 2=>{'s'=>3.94,'h'=>450000,}, 1=>{'s'=>4.42,'h'=>495000,}, 0=>{'s'=>4.90,'h'=>540000,},   },
	164 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	165 => { 7=>{'s'=>1.67,'h'=>160000,}, 6=>{'s'=>2.16,'h'=>190000,}, 5=>{'s'=>2.65,'h'=>220000,}, 4=>{'s'=>3.14,'h'=>250000,}, 3=>{'s'=>3.63,'h'=>280000,}, 2=>{'s'=>4.12,'h'=>310000,}, 1=>{'s'=>4.61,'h'=>340000,}, 0=>{'s'=>5.10,'h'=>370000,},   },
	166 => { 7=>{'s'=>1.67,'h'=>83000,}, 6=>{'s'=>2.16,'h'=>103000,}, 5=>{'s'=>2.65,'h'=>123000,}, 4=>{'s'=>3.14,'h'=>143000,}, 3=>{'s'=>3.63,'h'=>163000,}, 2=>{'s'=>4.12,'h'=>183000,}, 1=>{'s'=>4.61,'h'=>203000,}, 0=>{'s'=>5.10,'h'=>223000,},   },
	167 => { 7=>{'s'=>1.67,'h'=>36000,}, 6=>{'s'=>2.16,'h'=>43500,}, 5=>{'s'=>2.65,'h'=>51000,}, 4=>{'s'=>3.14,'h'=>58500,}, 3=>{'s'=>3.63,'h'=>66000,}, 2=>{'s'=>4.12,'h'=>73500,}, 1=>{'s'=>4.61,'h'=>81000,}, 0=>{'s'=>5.10,'h'=>88500,},   },
	168 => { 7=>{'s'=>1.67,'h'=>2140000,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	169 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>5.60,'h'=>1190000,},   },
	170 => { 7=>{'s'=>1.83,'h'=>7600,}, 6=>{'s'=>2.39,'h'=>9200,}, 5=>{'s'=>2.95,'h'=>10800,}, 4=>{'s'=>3.51,'h'=>12400,}, 3=>{'s'=>4.07,'h'=>14000,}, 2=>{'s'=>4.63,'h'=>15600,}, 1=>{'s'=>5.19,'h'=>17200,}, 0=>{'s'=>5.75,'h'=>18800,},   },
	171 => { 7=>{'s'=>1.83,'h'=>75000,}, 6=>{'s'=>2.39,'h'=>95000,}, 5=>{'s'=>2.95,'h'=>115000,}, 4=>{'s'=>3.51,'h'=>135000,}, 3=>{'s'=>4.07,'h'=>155000,}, 2=>{'s'=>4.63,'h'=>175000,}, 1=>{'s'=>5.19,'h'=>195000,}, 0=>{'s'=>5.75,'h'=>215000,},   },
	172 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	173 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	174 => { 7=>{'s'=>2.16,'h'=>17600,}, 6=>{'s'=>2.78,'h'=>21600,}, 5=>{'s'=>3.40,'h'=>25600,}, 4=>{'s'=>4.02,'h'=>29600,}, 3=>{'s'=>4.64,'h'=>33600,}, 2=>{'s'=>5.26,'h'=>37600,}, 1=>{'s'=>5.88,'h'=>41600,}, 0=>{'s'=>6.50,'h'=>45600,},   },
	176 => { 7=>{'s'=>1.69,'h'=>6100,}, 6=>{'s'=>2.17,'h'=>7600,}, 5=>{'s'=>2.65,'h'=>9100,}, 4=>{'s'=>3.13,'h'=>10600,}, 3=>{'s'=>3.61,'h'=>12100,}, 2=>{'s'=>4.09,'h'=>13600,}, 1=>{'s'=>4.57,'h'=>15100,}, 0=>{'s'=>5.05,'h'=>16600,},   },
	177 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	178 => { 7=>{'s'=>1.69,'h'=>7600,}, 6=>{'s'=>2.17,'h'=>9100,}, 5=>{'s'=>2.65,'h'=>10600,}, 4=>{'s'=>3.13,'h'=>12100,}, 3=>{'s'=>3.61,'h'=>13600,}, 2=>{'s'=>4.09,'h'=>15100,}, 1=>{'s'=>4.57,'h'=>16600,}, 0=>{'s'=>5.05,'h'=>18100,},   },
	179 => { 7=>{'s'=>1.69,'h'=>160000,}, 6=>{'s'=>2.17,'h'=>195000,}, 5=>{'s'=>2.65,'h'=>230000,}, 4=>{'s'=>3.13,'h'=>265000,}, 3=>{'s'=>3.61,'h'=>300000,}, 2=>{'s'=>4.09,'h'=>335000,}, 1=>{'s'=>4.57,'h'=>370000,}, 0=>{'s'=>5.05,'h'=>405000,},   },
	180 => { 7=>{'s'=>1.69,'h'=>850000,}, 6=>{'s'=>2.17,'h'=>1100000,}, 5=>{'s'=>2.65,'h'=>1350000,}, 4=>{'s'=>3.13,'h'=>1600000,}, 3=>{'s'=>3.61,'h'=>1850000,}, 2=>{'s'=>4.09,'h'=>2100000,}, 1=>{'s'=>4.57,'h'=>2350000,}, 0=>{'s'=>5.05,'h'=>2600000,},   },
	181 => { 7=>{'s'=>undef,'h'=>undef,}, 6=>{'s'=>undef,'h'=>undef,}, 5=>{'s'=>undef,'h'=>undef,}, 4=>{'s'=>undef,'h'=>undef,}, 3=>{'s'=>undef,'h'=>undef,}, 2=>{'s'=>undef,'h'=>undef,}, 1=>{'s'=>undef,'h'=>undef,}, 0=>{'s'=>undef,'h'=>undef,},   },
	);
    my(@list) = ();
    foreach my $id (@{$ids}) {
	next unless(exists($monsters{$id}));
	next unless(exists($monsters{$id}{$rank}));
	next unless($monsters{$id}{$rank}{h} > 0);
	next unless($monsters{$id}{$rank}{s} > 0);
	push @list,{ id => $id, speed => $monsters{$id}{$rank}{s}, health => $monsters{$id}{$rank}{h}, };
    }
    return \@list;
}
