An infinite complete binary tree is labeled with positive rational numbers by the following rules.
- The label of the root is 1/1.
- The left child of a node labeled p/q is labeled p/(p+q).
- The right child of a node labeled p/q is labeled (p+q)/q.
The top of the tree looks like the figure below.

Reading the tree in level order, that is breadth first and left to right within each level, gives the rational sequence F.
F(1)=1/1, F(2)=1/2, F(3)=2/1, F(4)=1/3, F(5)=3/2, F(6)=2/3,…
Given an index N, write a program that computes F(N).