#include <QApplication>
#include <QFileDialog>
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <iostream>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    QString fileName = QFileDialog::getOpenFileName(nullptr, "Select File", "", "All Files (*.*)");
    if (fileName.isEmpty()) return 1;

    QFile file(fileName);
    if (!file.exists() || !file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        std::cerr << "Failed to open file" << std::endl;
        return 1;
    }

    QTextStream in(&file);
    QString line = in.readLine();
    bool ok;
    int number = line.toInt(&ok);

    if (!ok) {
        std::cerr << "Failed to read integer from file" << std::endl;
        return 1;
    }

    std::cout << number * 2 << std::endl;
    return 0;
}
