Brute-force solution for 279, could probably avoid the use of sets (runs in 2 mins).