Given the following pairs of (input, result)

Input: 1, 6, 2, 2
Result: 6

Input: 1, 9, 2, 5
Result: 21

Input: 1, 12, 3, 6
Result: 84

Input: 2, 5, 5, 0
Result: 8

Input: 2, 6, 6, 0
Result: 13

Input: 2, 4, 4, 0
Result: 5

Input: 2, 2, 2, 0
Result: 2

Input: 2, 6, 4, 4
Result: 263

Input: 2, 5, 3, 4
Result: 94

Input: 2, 4, 3, 2
Result: 26

Input: 2, 3, 2, 2
Result: 11

Input: 3, 4, 6, 0
Result: 11

Input: 3, 4, 5, 2
Result: 123

Input: 3, 3, 4, 1
Result: 18

Input: 3, 3, 3, 3
Result: 56

Input: 3, 3, 2, 5
Result: 44

Input: 3, 3, 1, 7
Result: 12

Input: 3, 4, 4, 4
Result: 302

Input: 3, 4, 3, 6
Result: 267

Input: 3, 4, 2, 8
Result: 102

Input: 3, 4, 1, 10
Result: 17

Find a simple pattern match all above tests.