https://vjudge.net/contest/488731#problem/A