#8 TLE
#include<iostream>
#include<cstdio>
using namespace std;
#define maxn 1000001
int n,d,dot=0,cirs=0,cire=0;
int a[maxn],spe[maxn];
struct node
{
int shang,yu;
}tim[maxn];
void chushihua()
{
for(int i=1;i<maxn;i++)
{
tim[i].shang=-1;
tim[i].yu=-1;
}
}
bool check(int shang,int yu,int ci)
{
for(int i=1;i<ci;i++)
if(tim[i].shang==shang && tim[i].yu==yu) {cirs=i;cire=ci-1;return true;}
return false;
}
int suan(int zhi)
{
int ans=0;
while(zhi)
{
ans++;
zhi/=10;
}
return ans;
}
int main()
{
chushihua();
scanf("%d%d",&n,&d);
int per=n;
for(int i=1;;i++)
{
if(n<d && !dot)
{
tim[i].shang=0;tim[i].yu=n;
dot=i;
n*=10;
a[i]=0;
}
else
{
int num=n/d,mo=n%d;
a[i]=num;
if(!mo)
{
int now=0;
for(int j=1;j<=i;j++)
{
printf("%d",a[j]);
if(spe[j]) now+=spe[j];
else now++;
if(j==dot) {printf(".");now++;}
if(now%76==0 && now) printf("\n");
}
if(!dot) printf(".0");
return 0;
}
tim[i].shang=num;tim[i].yu=mo;
n=mo*10;
}
per-=tim[i].shang*d;
if(!dot) spe[i]=suan(tim[i].shang);
if(per<d && !dot) dot=i;
if(check(tim[i].shang,tim[i].yu,i))
{
int now=0;
for(int j=1;j<=i;j++)
{
bool flag=false;
if(j==cirs)
{
printf("(");now++;
if(now%76==0 && now && !flag) {printf("\n");flag=true;}
}
printf("%d",a[j]);
if(spe[j]) now+=spe[j];
else now++;
if(now%76==0 && now && !flag) {printf("\n");flag=true;}
if(j==dot)
{
printf(".");now++;
if(now%76==0 && now && !flag) {printf("\n");flag=true;}
}
if(j==cire) {printf(")");return 0;}
}
return 0;
}
}
return 0;
}