Abstract helpers and implementations for the first 18 problems.