#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

struct rational {
  /*有理数ライブラリ
  rint, num, den: rint + (num / den)
  整数部・小数部ともに9桁までは安全*/
  ll rint, num, den;
  
  //コンストラクタ
  rational(ll rint_=0, ll num_=0, ll den_=1) {
    if (den_ == 0) {
      cout << "Error: Denominator of type rational cannot be 0." << endl;
      exit(1);
    }
    if (den_ < 0) num_ *= -1, den_ *= -1;
    if (num_ < 0) {
      num_ *= -1;
      rint_ -= 1 + num_/den_;
      num_ = den_ - num_;
    }

    ll g = __gcd(num_, den_);
    num_ /= g, den_ /= g;
    rint_ += num_ / den_;
    num_ %= den_;
    rint = rint_, num = num_, den = den_;
  }

  rational(string s) {
    ll rint_ = 0, num_ = 0, den_ = 1;
    bool demicalpoint = false;
    for (int i = 0; i < (int)s.size(); i++) {
      if (s[i] == '.') {
        demicalpoint = true;
        continue;
      }
      if (!demicalpoint) {
        rint_ = rint_ * 10 + (s[i] - '0');
        continue;
      }
      else {
        num_ = num_ * 10 + (s[i] - '0');
        den_ *= 10;
        continue;
      }
    }
    ll g = __gcd(num_, den_);
    num_ /= g, den_ /= g;
    rint = rint_, num = num_, den = den_;
  }

  //算術演算子オーバーロード
  void operator=(const rational &other) {
    rint = other.rint, den = other.den, num = other.num;
    return;
  }

  rational operator+(const rational &other) {
    ll rint_, num_, den_;
    rint_ = rint + other.rint;
    den_ = den * other.den;
    num_ = num * other.den + den * other.num;
    return rational(rint_, num_, den_);
  }
  void operator+=(const rational &other) {
    rational r = *this + other;
    rint = r.rint, num = r.num, den = r.den;
    return;
  }

  rational operator-(const rational &other) {
    ll rint_, num_, den_;
    rint_ = rint - other.rint;
    den_ = den * other.den;
    num_ = num * other.den - den * other.num;
    return rational(rint_, num_, den_);
  }
  void operator-=(const rational &other) {
    rational r = *this - other;
    rint = r.rint, num = r.num, den = r.den;
    return;
  }

  rational operator*(const rational &other) {
    ll rint_, num_, den_;
    //rint_ = rint * other.rint;
    rational temp1(0, rint*other.num, other.den), temp2(0, other.rint*num, den), temp3(0, num*other.num, den*other.den);
    rint_ = rint * other.rint + temp1.rint + temp2.rint + temp3.rint;
    temp1 -= temp1.rint, temp2 -= temp2.rint;
    temp3 += temp1 + temp2;
    rint_ += temp3.rint;
    num_ = temp3.num, den_ = temp3.den;
    return rational(rint_, num_, den_); 
  }
  void operator*=(const rational &other) {
    rational r = *this * other;
    rint = r.rint, num = r.num, den = r.den;
    return;
  }

  rational operator/(const rational &other) {
    return *this * rational(0, other.den, other.den*other.rint + other.num);
  }
  void operator/=(const rational &other) {
    rational r = *this / other;
    rint = r.rint, num = r.num, den = r.den;
    return;
  }

};

//比較演算子（外側に書く）
bool operator==(const rational &r1, const rational &r2) {
  return ((r1.rint == r2.rint) && (r1.num == r2.num) && (r1.den == r2.den));
}
bool operator>(const rational &r1, const rational &r2) {
  if (r1.rint != r2.rint) return r1.rint > r2.rint;
  return r1.num * r2.den > r1.den * r2.num;
}
bool operator<(const rational &r1, const rational &r2) {
  if (r1.rint != r2.rint) return r1.rint < r2.rint;
  return r1.num * r2.den < r1.den * r2.num;
}
bool operator>=(const rational &r1, const rational &r2) {
  return !(r1 < r2);
}
bool operator<=(const rational &r1, const rational &r2) {
  return !(r1 > r2);
}

//以上


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)

  /*rational r1(1, -2, 6), r2(2, 1, 3), r3(3, 1, 4), r4(2, 4, 6), r5(2, 2, 6);
  set<rational> rats;
  rats.insert(r1), rats.insert(r2), rats.insert(r3), rats.insert(r4), rats.insert(r5);

  for (auto r: rats) {
    cout << r.rint << " + " << r.num << " / " << r.den << endl;
  }
 
  rational rs("123.4566000120");
  cout << rs.rint << " + " << rs.num << " / " << rs.den << endl;*/

  ll a;
  string sb;
  cin >> a >> sb;
  rational b(sb);
  //cout << (b * a).rint << " + " << (b * a).num << " / " << (b * a).den << endl;
  cout << (b * a).rint << endl;
}


Measured memory_bytes: 3656