UVa 10523 - Very Easy !!!

10523 - Very Easy!!!

 * http://acm.uva.es/p/v105/10523.html

Summary
This is a straightforward problem involving BigNum.

Explanation
This is a straightforward problem involving BigNum. You can cache results to speed it up.

Input
3 3 4 4 0 1 150 15 0 5 5 1 0 0 0 150 0 1 51 15 100 5 91 19 150 15

Output
102 1252 0 41642470296774462562792725985031884205969838044105091368779920844033177704061607491770151984953636682503436650913970981305172726267418523206995220099298301053694354332223230478715 0 15 0 0 0 52188994475428012744377141543018279541999562548435464197275590 983610941197449094872749054836974080123779273776563059072941541671752930 22327235688889146589532157312402720205037854173376096622440478693113127127969987128888119845332970522494139863140841674 41642470296774462562792725985031884205969838044105091368779920844033177704061607491770151984953636682503436650913970981305172726267418523206995220099298301053694354332223230478715