add horribly inefficient solution for 31