#!/usr/bin/perl

$y[1] = 1; $n[1] = 0;
$yc = 0; $nc = 0;
$t = 100;

for ($i = 1; $i < $t; $i++) {
  $y[$i+1] = (4 * $y[$i]) + (2 * $n[$i]);
  $n[$i+1] = (1 * $y[$i]) + (3 * $n[$i]);
}

for ($i = 1; $i < $t; $i++) {
  $yc = $yc + $y[$i];
  $nc = $nc + $n[$i];
}

$p = $yc / ($yc + $nc);

print "Percentage: $p\n";

