#!/usr/bin/env tclsh

gets stdin cpub

proc brute {pub} {
  set s 7; set n 1
  while {$s != $pub} {
    set s [expr {($s * 7) % 20201227}]
    incr n
  }
  return $n
}
puts [brute $cpub]