#!/usr/bin/perl
use 5.016;
use warnings;
sub gcd { $_[1] ? gcd($_[1], $_[0] % $_[1]) : $_[0] }
sub step
{ map{ [$_[0] * $_ / $_[2], $_[1] * $_ / $_[2]] } (0 .. $_[2]) }
sub f
{ step
($_[0], $_[1], gcd
(abs $_[0], abs $_[1])) }
say
join("\n", map{ "@{$_}" } f
(54, 66));
IyEvdXNyL2Jpbi9wZXJsCnVzZSA1LjAxNjsKdXNlIHdhcm5pbmdzOwoKc3ViIGdjZCB7ICRfWzFdID8gZ2NkKCRfWzFdLCAkX1swXSAlICRfWzFdKSA6ICRfWzBdIH0KCnN1YiBzdGVwIHsgbWFweyBbJF9bMF0gKiAkXyAvICRfWzJdLCAkX1sxXSAqICRfIC8gJF9bMl1dIH0gKDAgLi4gJF9bMl0pIH0KCnN1YiBmIHsgc3RlcCgkX1swXSwgJF9bMV0sIGdjZChhYnMgJF9bMF0sIGFicyAkX1sxXSkpIH0KCnNheSBqb2luKCJcbiIsIG1hcHsgIkB7JF99IiB9IGYoNTQsIDY2KSk7Cg==