Regarding your quote,「ったく、銀貨5枚とどちらが割に合うんだかな」," "ったく" doesn't make sense in Japanese. Is it "全く"?Something Something is missing.
"どちらが割に合うんだかな" means "Which would it betterbe worth more?" or "Which is more advantageous (profittableprofitable)?"
MoreA more common way of saying this is "どちらが割に合うのかな" or "どちらが割に合うの(ん)だか." I think "な" at the tail is used for the pourpsepurpose of emphasis or self-afirmationaffirmation. It's a coloquialcolloquial turn of phrase, but it's very, very rare to hear such an expression - 割に合うんだかな.