Problem A
Tourists
In Tree City, there are
You are a member of the Tree City planning committee. After
much research into tourism, your committee has discovered a
very interesting fact about tourists: they LOVE number theory!
A tourist who visits an attraction with label
Consider this city map:
Here are all the paths that tourists might take, with the
lengths for each:
To take advantage of this phenomenon of tourist behavior,
the committee would like to determine the number of attractions
on paths from an attraction
Input
Each input will consist of a single test case. Note that
your program may be run multiple times on different inputs. The
first line of input will consist of an integer
Output
Output a single integer, which is the sum of the lengths of
all paths between two attractions
Sample Input 1 | Sample Output 1 |
---|---|
10 3 4 3 7 1 4 4 6 1 10 8 10 2 8 1 5 4 9 |
55 |