Very cool little puzzle, thanks Draknek!
Here's my absolutely rigorous, fiercely logical and not at all intuive walkthrough for those that need a hint (rot13):
Jr arrq gb svaq n frg bs nafjref gb gur svir dhrfgvbaf fb gung gurer rkvfgf rknpgyl bar 4-qvtvg qrpvzny ahzore gung fngvfsvrf gur nafjre frg, juvyr gurer zhfg or ab erqhaqnag dhrfgvbaf.
Jr pna vzzrqvngryl frr gung gur nafjre gb dhrfgvba 1 vf Ab orpnhfr bgurejvfr dhrfgvba 4 jbhyq or erqhaqnag.
Sebz urer, yrg'f vaghvgviryl znxr rqhpngrq nffhzcgvbaf naq gel gb nffvta nafjref fb gung rnpu nafjre unf znkvzhz "vzcnpg" naq guhf gvtugraf gur fbyhgvba fcnpr sbe gur qvtvgf gur zbfg:
Yrg'f svk gur frpbaq naq guveq qvtvg naq nffhzr gur nafjref gb dhrfgvbaf 2 naq 3 ner obgu "lrf".
Jr gura xabj gung gur fhz bs gur 2aq naq 3eq qvtvg vf 5. Sebz urer, jr nffhzr gung nafjre 5 vf nyfb "lrf", fb jr gura xabj gung qvtvg 4 arrqf gb or "ovt".
Fb gur dhrfgvba vf: pna jr svaq n qvtvg 1 gung jr nqq gb 5 naq fgvyy svaq n qvtvg 4 gung'f ovttre?
Gurer ner frireny, ohg vs jr nyfb nffhzr nafjre 4 vf "ab", gura qvtvg 1 zhfg ng yrnfg or 3 (vg pnaabg or rira, naq vg pnaabg or 1). Gura jr trg 3+2+3 < qvtvg 4, fb qvtvg 4 pna bayl or 9.
Fb abj jr'ir svkrq na nafjre frg (ab,lrf,lrf,ab,lrf) gung yrnirf hf jvgu rknpgyl bar cva ahzore: guerr gjb guerr avar