user
An evil wizard has trapped you in the stairwell of his castle. Your only hope of escape is to run up all 100 steps to reach the top, and you can run one step per second. Unfortunately the wizard uses magic to lengthen the staircase by five steps per second. The new steps are inserted randomly between existing steps, so if you're lucky some of them might be beneath you and not ahead of you.

Can you escape, or are you doomed to run up an ever-lengthening staircase forever?

Write a program to simulate your escape attempt. How are you doing after ten minutes? For every second between 600 and 609 seconds inclusive print the number of steps behind you and the number still ahead of you.

If you escaped, run 10,000 tests and print the average time taken and the average final length of the staircase.
assistant
```
my ($trials, $t-total, $s-total) = 10000;

say 'Seconds  steps behind  steps ahead';

race for ^$trials {
    my $stairs   = 100;
    my $location = 0;
    my $seconds  = 0;

    loop {
        ++$seconds;
        ++$location;
        last if $location > $stairs;
        for (1..$stairs).roll(5) {
            ++$location if $_ <= $location;
            ++$stairs;
        }
        say "  $seconds        $location         {$stairs-$location}" if !$_ && (599 < $seconds < 610);
    }

    $t-total += $seconds;
    $s-total += $stairs;
}

say "Average seconds: {$t-total/$trials},  Average steps: {$s-total/$trials}";

```

Sample output:

```
Seconds  steps behind  steps ahead
  600        2143         957
  601        2149         956
  602        2153         957
  603        2158         957
  604        2164         956
  605        2170         955
  606        2175         955
  607        2178         957
  608        2183         957
  609        2187         958
Average seconds: 2716.0197,  Average steps: 13677.143
```