A,B,C,D are four friends. Each of them have a string that are very precious to them. One Unfortunate day all of the strings got stolen. Now everybody want their strings back. All of them decided that this time they will keep all of their string together in form of a large string Y such that original strings of A,B,C,D will be substring of Y. But they do not want this string to take a lot of space. So they want Y such that length of Y is minimized. Can you help them with their problem ?
INPUT
There will be exactly 4 lines of input. Each will contain a string.
OUTPUT
Minimum possible length of string Y.