Simple unoptimized solution for 412.