#include "iostream"
#include "fstream"
#include "string"
#include "stdio.h"
using namespace std;
typedef struct BiNode{
int data;
struct BiNode *left, *right;
}BiNode, *BiTree;
void CreateBiTree(BiTree &t)
{
int number;
cin>>number;
if( number == -1 ) t = NULL;
else{
if(!(t = (BiNode *)malloc(sizeof(BiNode)))) exit(1);
t->data = number;
CreateBiTree(t->left);
CreateBiTree(t->right);
}
}
void preOrder(BiTree t)
{
if(t)
{
cout<<t->data;
if(t->left!=NULL || t->right!=NULL)
{
cout<<"(";
preOrder(t->left);
cout<<",";
preOrder(t->right);
cout<<")";
}
}
}
int main()
{
BiTree t;
CreateBiTree(t);
preOrder(t);
system("pause");
return 0;
}