package main import . "fmt" import . "math/big" func main() { var n int Scan(&n) // 10^k = 1 (mod n) ?? Euler's totient function?? r := NewRat(int64(n), 1) t := make([]bool, 1e5) one := NewRat(1,1) x := n for i := 2; i*i<=x; i++ { if t[i] || x%i != 0 { continue } for x % i == 0 { x /= i } r.Mul(r, new(Rat).Sub(one, NewRat(1, int64(i)))) for j := i+i; j < len(t); j += i { t[j] = true } } if x > 1 { r.Mul(r, new(Rat).Sub(one, NewRat(1, int64(x)))) } Println(r.Num()) }