#!/usr/bin/env perl use strict; use warnings; use Math::BigInt; my ($x, $y) = split / /, <>; chomp $y; my $gcd = Math::BigInt::bgcd($x, $y); print $gcd;