Link to onlinejudge.org: tinyurl.com/pawzykm ( I wrote it for onlinejudge.org but then it was to smart for it and it wasn't accepted cause I covered the infinity problem as well. Sorry, that everything is static and not OOP but I just can paste code or upload one file to onlinejudge.org, thats why I have to write such absurd code.)