#pragma GCC optimize ( "O3" ) #pragma GCC optimize( "unroll-loops" ) #pragma GCC target ( "sse4.2,fma,avx2,popcnt,lzcnt,bmi2" ) #include using namespace std; using ll = long long; #define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr ) #define TYPE_OF( VAR ) decay_t #define CEXPR( LL , BOUND , VALUE ) constexpr LL BOUND = VALUE #define CIN( LL , A ) LL A; cin >> A #define ASSERT( A , MIN , MAX ) assert( MIN <= A && A <= MAX ) #define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX ) #define FOREQ( VAR , INITIAL , FINAL ) for( TYPE_OF( FINAL ) VAR = INITIAL ; VAR <= FINAL ; VAR ++ ) #define COUT( ANSWER ) cout << ANSWER << "\n" #define QUIT return 0 #define RETURN( ANSWER ) COUT( ( ANSWER ) ); QUIT int main() { CEXPR( ll , bound , 20 ); CIN_ASSERT( N , - bound , bound ); if( N > 0 ){ RETURN( "0/1" ); } N *= -1; ll sum = 0; ll N_half = ( N + 1 ) / 2; ll comb = ( N % 2 == 0 ? 1 : N_half ); FOREQ( k , N_half , N ){ sum = sum * 10 + ( k % 2 == 0 ? comb : - comb ); comb *= ( k + 1 ) * ( N - k ); comb /= ( k * 2 + 1 - N ) * ( k * 2 + 2 - N ); } if( sum == 0 ){ RETURN( "0/1" ); } while( sum % 10 == 0 ){ sum /= 10; N--; } string d = "1"; while( N-- >= 0 ){ d += "0"; } COUT( sum << "/" << d ); QUIT; }