import java.util.*; import java.io.*; public class another { public static void main(String[] argh) throws Exception { Scanner in = new Scanner(new File("another.in")); int people; int rounds; int help; int[] tickets; int maxTicketsInRound; people = in.nextInt(); rounds = in.nextInt(); while(people != 0 && rounds != 0) { tickets = new int[people]; maxTicketsInRound = 0; for(int i = 0; i < people; i++) { for(int j = 0; j < rounds - 1; j++) { in.nextInt(); } help = in.nextInt(); tickets[i] = help; maxTicketsInRound += help; } for(int i = 0; i < people; i++) { printFraction(tickets[i], maxTicketsInRound); } people = in.nextInt(); rounds = in.nextInt(); } in.close(); System.exit(0); } public static void printFraction(int tickets, int maxTickets) { int ggt = ggt(tickets, maxTickets); if(ggt != 0) { tickets /= ggt; maxTickets /= ggt; } else { tickets = 0; maxTickets = 1; } System.out.println(tickets + " / " + maxTickets); } public static int ggt(int a, int b) { if(a < 1 || b < 1) { return 0; } int help; while(a != b) { if(a > b) { if(a % b != 0) { a = a - (a / b) * b; } else { a = a - b; } } else { if(b % a != 0) { b = b - (b / a) * a; } else { b = b - a; } } } return a; } }