LinkedIn interview question

sum of nested weighted intergers