#include <iostream>
#include <iterator>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>

int main()
{
  bool result;

  // Read the line
  std::string line;
  std::getline(std::cin, line);

  // Split the line at spaces (https://stackoverflow.com/a/237280/1944004)
  std::istringstream iss(line);
  std::vector<std::string> tokens{std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{}};

  // Convert last element to bool
  if (tokens.back() == "true") result = true;
  else if (tokens.back() == "false") result = false;
  else throw std::invalid_argument("The last argument is not a boolean!");

  // Remove the last element
  tokens.pop_back();

  // Loop over the nots
  for (auto const& t : tokens)
  {
    if (t == "not") result = !result;
    else throw std::invalid_argument("Negation has to be indicated by 'not'!");
  }

  // Output the result
  std::cout << std::boolalpha << result << '\n';
}