#include <iostream>
using namespace std;
void sequence( int * tree, int * given, int position, int i, int j) // посторение дерева
{
if ( i == j)
tree[ position] = given[ i] > 0 ? 1 : ( given[ i] < 0 ? - 1 : 0 ) ; // заменяем элементы последовательности на "1","-1","0" в соответсвии с условием для команды "P"
else if ( i! = j) // для остальных элементов воспользуемся следующим алгоритмом
{
int m = ( i + j) / 2 ;
sequence( tree, given, position * 2 , i, m) ;
sequence( tree, given, position * 2 + 1 , m + 1 , j) ;
tree[ position] = tree[ position * 2 ] * tree[ position * 2 + 1 ] ; // элемент с номером (pos * 2) – левый потомок, а с (pos * 2 + 1) - правый потомок
}
}
void For_C_command( int * tree, int position, int i, int j, int nposition, int v) // функция изменения элемента (для выполнения команлы "С")
{
if ( i == j)
tree[ position] = v > 0 ? 1 : ( v < 0 ? - 1 : 0 ) ;
else if ( i! = j)
{
int m = ( i + j) / 2 ;
if ( nposition <= m)
For_C_command( tree, position * 2 , i, m, nposition, v) ;
else
For_C_command( tree, position * 2 + 1 , m + 1 , j, nposition, v) ;
tree[ position] = tree[ position * 2 ] * tree[ position * 2 + 1 ] ;
}
}
int For_P_command( int * tree, int position, int i, int j, int qi, int qj) // функция для выполнения команды "Р"
{
if ( i == qi && j == qj)
return tree[ position] ;
else
{
int m = ( i + j) / 2 ;
if ( qj <= m)
return For_P_command( tree, position * 2 , i, m, qi, qj) ;
else if ( qi >= m + 1 )
return For_P_command( tree, position * 2 + 1 , m + 1 , j, qi, qj) ;
else
return For_P_command( tree, position * 2 , i, m, qi, m) * For_P_command( tree, position * 2 + 1 , m + 1 , j, m + 1 , qj) ;
}
}
int main( )
{
ios:: sync_with_stdio ( false ) ; // ускоряем чтение
int n, k;
while ( cin >> n >> k)
{
int given[ n] ;
for ( int i = 0 ; i < n; i++ )
cin >> given[ i] ;
int tree[ n * 4 ] ;
sequence( tree, given, 1 , 0 , n - 1 ) ;
for ( int i = 0 ; i < k; i++ )
{
char command;
int xi, xj;
cin >> command >> xi >> xj;
if ( command == 'P' )
{
int x = For_P_command( tree, 1 , 0 , n - 1 , xi - 1 , xj - 1 ) ; // применяем функцию для команды "Р" и выполняем сравнения, соответствующие условию задачи
if ( x < 0 )
printf ( "-" ) ;
else if ( x > 0 )
printf ( "+" ) ;
else
printf ( "0" ) ;
}
else
For_C_command( tree, 1 , 0 , n - 1 , xi - 1 , xj) ;
}
printf ( "\n " ) ;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCnZvaWQgc2VxdWVuY2UoaW50KiB0cmVlLCBpbnQqIGdpdmVuLCBpbnQgcG9zaXRpb24sIGludCBpLCBpbnQgaikgLy8g0L/QvtGB0YLQvtGA0LXQvdC40LUg0LTQtdGA0LXQstCwCnsKCWlmIChpID09IGopCgkJdHJlZVtwb3NpdGlvbl0gPSBnaXZlbltpXSA+IDAgPyAxIDogKGdpdmVuW2ldIDwgMCA/IC0xIDogMCk7IC8vINC30LDQvNC10L3Rj9C10Lwg0Y3Qu9C10LzQtdC90YLRiyDQv9C+0YHQu9C10LTQvtCy0LDRgtC10LvRjNC90L7RgdGC0Lgg0L3QsCAiMSIsIi0xIiwiMCIg0LIg0YHQvtC+0YLQstC10YLRgdCy0LjQuCDRgSDRg9GB0LvQvtCy0LjQtdC8INC00LvRjyDQutC+0LzQsNC90LTRiyAiUCIgCgllbHNlIGlmIChpIT1qKSAgLy8g0LTQu9GPINC+0YHRgtCw0LvRjNC90YvRhSDRjdC70LXQvNC10L3RgtC+0LIg0LLQvtGB0L/QvtC70YzQt9GD0LXQvNGB0Y8g0YHQu9C10LTRg9GO0YnQuNC8INCw0LvQs9C+0YDQuNGC0LzQvtC8Cgl7CgkJaW50IG0gPSAoaSArIGopIC8gMjsKCQlzZXF1ZW5jZSh0cmVlLCBnaXZlbiwgcG9zaXRpb24gKiAyLCBpLCBtKTsKCQlzZXF1ZW5jZSh0cmVlLCBnaXZlbiwgcG9zaXRpb24gKiAyICsgMSwgbSArIDEsIGopOwoJCXRyZ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