fork download
  1. #!/usr/bin/perl6
  2. use strict;
  3. use warnings;
  4. use 5.010;
  5.  
  6.  
  7. my $line1 = <>;
  8. chomp($line1);
  9. my @ab = split(" ",$line1);
  10. my $a = $ab[0];
  11. my $b = $ab[1];
  12.  
  13. my $line2 = <>;
  14. chomp($line2);
  15. my @cd = split(" ",$line2);
  16. my $c = $cd[0];
  17. my $d = $cd[1];
  18.  
  19. my $output = -1;
  20.  
  21. OUTERLOOP: for(my $i = $b; $i < 10000; $i += $a)
  22. {
  23. for(my $j = $d; $j < 10000; $j += $c)
  24. {
  25. if($i == $j)
  26. {
  27. $output = $i;
  28. last OUTERLOOP;
  29. }
  30. }
  31. }
  32.  
  33. say $output;
  34.  
Runtime error #stdin #stdout #stderr 0.1s 98688KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
===SORRY!===
Could not find warnings at line 3 in:
    /home/kMyFcH/.perl6
    /usr/share/perl6/site
    /usr/share/perl6/vendor
    /usr/share/perl6
    CompUnit::Repository::AbsolutePath<59253600>
    CompUnit::Repository::NQP<53552352>
    CompUnit::Repository::Perl5<53552392>