1. 


/* 264: Count of Cantor
* Miesel Christoph
* Seilbeck Robert
* Wolfram Andre

* Runtime: 0.390
*/

import java.io.*;
import java.util.*;

class Cantor2
{



/**********************************************
* Cantor-Algorithmus und Eingaben-Einlesung *
**********************************************/

public static void main(String[] args) throws Exception
{
// Einlesevorgang

int input = -1;
Scanner sc = new Scanner(System.in);
input = sc.nextInt();

/*******************************************
* counter enthält die maximale Größe *
* des Zählers oder des Nenners *
* in einer Diagonale (Gauss "n") *
*******************************************/
int counter = 0;
int summe = 0;

// Variablendeklaration und Startwertvergabe

int num = -1;
int denom = -1;

while(true)
{

// Count-Cantor-Algorithmus
while(summe < input)
{

counter++;
summe += counter;

}

if(counter % 2 == 0)
{
num = counter+input-((counter+1)*counter)/2;
denom = 1+((counter+1)*counter)/2-input;
}
else
{
num = 1+((counter+1)*counter)/2-input;
denom = counter+input-((counter+1)*counter)/2;
}
counter = 0;
summe = 0;

System.out.printf("TERM "+input+" IS "+num+"/"+denom);
System.out.println();

if(sc.hasNext())
{

input = sc.nextInt();

}
else break;
}
}
}