several more optimizations to uva11565 - simple equatiosn