fork download
  1. #!/usr/bin/perl6
  2. use 5.010;
  3.  
  4.  
  5. my $line1 = <>;
  6. chomp($line1);
  7. my @ab = split(" ",$line1);
  8. my $a = $ab[0];
  9. my $b = $ab[1];
  10.  
  11. my $line2 = <>;
  12. chomp($line2);
  13. my @cd = split(" ",$line2);
  14. my $c = $cd[0];
  15. my $d = $cd[1];
  16.  
  17. my $output = -1;
  18.  
  19. OUTERLOOP: for(my $i = $b; $i < 10000; $i += $a)
  20. {
  21. for(my $j = $d; $j < 10000; $j += $c)
  22. {
  23. if($i == $j)
  24. {
  25. $output = $i;
  26. last OUTERLOOP;
  27. }
  28. }
  29. }
  30.  
  31. say $output;
  32.  
Runtime error #stdin #stdout #stderr 0.08s 98496KB
stdin
20 2
9 19
stdout
Standard output is empty
stderr
===SORRY!=== Error while compiling /home/nQaHAh/prog.pl
Unsupported use of <>; in Perl 6 please use lines() to read input, ('') to represent a null string or () to represent an empty list
at /home/nQaHAh/prog.pl:5
------> my $line1 = <⏏>;