Dinner Menu Roulette

Count rotations that turn the current wheel letters into the target menu string and print the share as a reduced fraction.

Medium4String matchingMathNo attempts yetTime limit5sMemory limit256 MB

Problem

Suwon and his friends can never settle on a dinner menu. When Suwon gets hungry enough to pick one himself and the others object, he spins a circular roulette wheel instead.

The wheel is divided into exactly NN cells, and each cell carries one uppercase letter. After the wheel stops, you read the cells clockwise starting from the 12 o'clock position, and the resulting string of letters decides dinner. The arrow at 12 o'clock never lands between two cells, so it always points at exactly one cell, and after a spin each of the NN cells is equally likely to be the one at 12 o'clock.

Today Suwon suggested meat, the others objected again, and the wheel comes out. Write a program that computes the probability that Suwon gets meat for dinner.

Input

The first line contains the number of cells NN (1N1,000,0001 \le N \le 1{,}000{,}000).

The second line contains the wheel pattern that means meat for dinner, given as NN single letters separated by spaces, read clockwise from the 12 o'clock position.

The third line contains the current wheel pattern in the same format, also NN single letters separated by spaces and read clockwise from 12 o'clock.

Every letter is an uppercase letter of the alphabet.

Output

Print the probability of getting meat as a fraction in lowest terms, meaning the numerator and the denominator share no common divisor larger than 1. Use the format numerator/denominator with no spaces around the slash.

If the wheel gives meat no matter where it stops, print 1/1. At least one stopping position gives meat, so the numerator is never 0.