# [Pyth][1], <s>11</s> 10 bytes !es*V*jT7l Accepts input as a list of digits. Try it online [here][2], or verify all test cases at once [here][3]. !es*V*jT7lQQ Implicit: Q=eval(input()) Trailing QQ implied jT7 10 in base 7 - yields [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not *Edit: saved a byte by replacing `,1 3` with `jT7`* [1]: https://github.com/isaacg1/pyth [2]: https://pyth.herokuapp.com/?code=%21es%2AV%2AjT7l&input=%5B8%2C9%2C2%2C3%2C6%2C4%2C2%2C4%2C6%2C9%2C5%2C5%2C9%5D&debug=0 [3]: https://pyth.herokuapp.com/?code=%21es%2AV%2AjT7l&test_suite=1&test_suite_input=%5B6%2C5%2C3%2C7%2C2%2C6%2C3%2C7%2C2%2C9%2C3%2C8%2C5%5D%0A%5B1%2C9%2C0%2C2%2C9%2C5%2C6%2C8%2C4%2C7%2C4%2C2%2C7%5D%0A%5B9%2C3%2C4%2C6%2C7%2C3%2C5%2C8%2C7%2C7%2C2%2C4%2C6%5D&debug=0