#!/usr/bin/env perl use strict; use warnings; my $idol = <>; chomp $idol; my $x = $idol - 7; print $x < 8 ? -1 : $x; exit; # かăȘしい for (my $x = 8; $x < 100; $x++) { my $n = $idol; my $ans = 0; while ($n > 0) { $ans *= 10; $ans += $n % $x; $n = int($n / $x); } if ($ans == 71) { print $x; exit; } } print -1