Project Euler 918 - Recursive Sequence Summation

Official link: https://projecteuler.net/problem=918

Note: Do not read further since the spoiler is an instant solve! Try expanding S(N) if you're stuck.