UVA529 Addition Chains

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=470 [PDF](https://uva.onlinejudge.org/external/5/p529.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA529/0cf6e4f370f0135a68e11c531b88bafdcabeaddf.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA529/442cc11ac645016f32b2e5060d8cfc30396f272c.png)

Output Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA529/fe878da16d793f0355065ba06f2ba0e19c032631.png)