#include<stdio.h> #include<string.h> #define ll long long #define N 110000 int main() { ll i,sum,b,k,len,f[N]; char s[N],st[3]; while(scanf("%s%s%lld",s,st,&b)!=EOF) { if(strcmp(st,"/")==0) { sum=0;len=0; for(i=0;s[i];i++) { sum=sum*10+s[i]-'0'; f[len++]=sum/b; sum=sum%b; } k=0; for(i=0;i<len;i++) { if(k) printf("%lld",f[i]); else if(f[i]){ k=1; printf("%lld",f[i]); } } if(k==0) printf("0"); printf(" "); } else { sum=0; for(i=0;s[i];i++) { sum=sum*10+s[i]-'0'; sum=sum%b; } printf("%lld ",sum); } } return 0; }