#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>

struct Bar {
    long long timestamp;
    double open, high, low, close;
    long long volume;
};

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    // TODO: Read first line: SIDE, TOTAL_QTY, NUM_BARS
    std::string side;
    long long total_qty, num_bars;

    // TODO: Read all market data bars (timestamp, open, high, low, close, volume)
    // You may parse CSV manually (comma-delimited) or use string parsing
    std::vector<Bar> bars;

    // TODO: Compute arrival_price (first bar's open)
    double arrival_price;

    // TODO: TWAP Strategy
    // - base_qty = total_qty / num_bars
    // - remainder = total_qty % num_bars
    // - First 'remainder' bars execute base_qty + 1, others execute base_qty
    // - Execution price at each bar: (open + high + low + close) / 4
    // - Calculate twap_avg_price and twap_cost
    std::vector<long long> twap_qty;
    double twap_total_cost = 0.0;
    double twap_avg_price = 0.0;
    long long twap_bars_executed = 0;

    // TODO: VWAP Strategy
    // - Sum total volume across all bars
    // - For each bar, compute cumulative volume fraction
    // - child_qty_i = round(total_qty * cum_frac) - already_executed
    // - Last bar gets remainder to ensure sum = total_qty
    // - Calculate vwap_avg_price and vwap_cost
    std::vector<long long> vwap_qty;
    double vwap_total_cost = 0.0;
    double vwap_avg_price = 0.0;
    long long vwap_bars_executed = 0;

    // TODO: Compute implementation shortfalls
    // For BUY: shortfall = (avg_price - arrival_price) / arrival_price
    // For SELL: shortfall = (arrival_price - avg_price) / arrival_price
    double twap_shortfall = 0.0;
    double vwap_shortfall = 0.0;

    // Output 9 lines, 6 decimal places
    std::cout << std::fixed << std::setprecision(6);
    std::cout << arrival_price << "\n";
    std::cout << twap_avg_price << "\n";
    std::cout << vwap_avg_price << "\n";
    std::cout << twap_shortfall << "\n";
    std::cout << vwap_shortfall << "\n";
    std::cout << twap_total_cost << "\n";
    std::cout << vwap_total_cost << "\n";
    std::cout << twap_bars_executed << "\n";
    std::cout << vwap_bars_executed << "\n";

    return 0;
}
