The managers of a chemical plant, which is notorious for its high pollution, plan to adopt a newly developed device in order to reduce the amount of contaminants emitted. However, engineers in the plant are against this plan, as they doubt the usefulness of the device. As engineers only believe in experimental results, managers decide to hire programmers to make a numerical experiment to convince the engineers.
The new pollution-reducing device consists of several tanks with pipes connecting the tanks. You may assume there is at most one pipe between two tanks. Two tanks are called adjacent if a pipe connects them. When operating, the contaminant circulates in the device among these tanks.
As shown in the Figure-1, the contaminant in one tank in time t, will equally distribute into all adjacent tanks in the time t+1. In other words, if we use X
it to denote the amount of contaminant in tank i at time t, we can use the following formula:
__poj_jax_start__X_i^{t+1}=\sum_j\frac{I_{ij}X_j^t}{d_j}__poj_jax_end__
where I
ij=1 if tank i and tank j are adjacent, otherwise I
ij=0, and where d
j is the number of tanks adjacent to tank j. If no tank is adjacent to tank i, we have X
it+1=X
it.
The managers, as well as the engineers, want to know that given the initial amount of contaminant in each tank, how the contaminant will be distributed in all the tanks after a long period of time in circulation. Namely, given X
i0 for all i, what are X
it when the difference between X
it and X
it+1 is so small that it can be ignored. You may assume that this condition will ALWAYS be attained from an initial case in this problem.