Upside down primes

Problem Name:
Upside down primes
Site:CodeForces
Links:
Tags:
Problem setters: