# Python 2, 43 bytes lambda i:i[1]-i[3]+2*(sum(i)+i[2]+5*min(i)) Inspired by @user2487951's answer.