这是一道初等数论的题。特别注意的是题目中说了给的数一定是个基数(自己英语太渣)首先我们知道的是它最多只能分解成3个素数的和,所以我们只需要分别考虑分成一个数两个数三个数的情况。分成一个数就只能是它自己是个素数。如果分成两个数,那么只能是一个奇数一个偶数,偶数是素数的就只有2,判断n-2就ok,分成3个数的话,有可能是3个奇数或者说一个奇数两个2,注意,素因子分解中两个素数最大距离不超过300,看了大佬的代码才知道的。

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int n;
int prim(int n)
{if(n==3||n==5||n==7)  return 1;if(n%2==0||n%3==0||n%5==0||n%7==0) return 0;for(int i=7;i<=sqrt(n);i++){if(n%i==0)return 0;}return 1;
}
int main()
{int i,j,k,index;scanf("%d",&n);if(prim(n)){printf("1\n%d\n",n);}else{if(prim(n-2)){printf("2\n2 %d\n",n-2);}else{if(prim(n-4)){printf("3\n2 2 %d\n",n-4);}else{for(i=n-3;i>=n-300;i--){if(i<1) break;if(prim(i)){index=i;break;}}k=n-i;if(prim(k)){printf("2\n%d %d\n",index,k);}else{for(i=2;i<=k;i++){if(prim(i)&&prim(k-i)){printf("3\n%d %d %d\n",index,i,k-i);break;}}}}}return 0;}
}

Dima loves representing an odd number as the sum of multiple primes, and Lisa loves it when there are at most three primes. Help them to represent the given number as the sum of at most than three primes.

More formally, you are given an odd numer n. Find a set of numbers pi (1 ≤ i ≤ k), such that

  1. 1 ≤ k ≤ 3
  2. pi is a prime

The numbers pi do not necessarily have to be distinct. It is guaranteed that at least one possible solution exists.

Input

The single line contains an odd number n (3 ≤ n < 109).

Output

In the first line print k (1 ≤ k ≤ 3), showing how many numbers are in the representation you found.

In the second line print numbers pi in any order. If there are multiple possible solutions, you can print any of them.

Examples

Input

27

Output

3
5 11 11

Note

A prime is an integer strictly larger than one that is divisible only by one and by itself.

Dima and Lisa相关推荐

  1. Codeforces 358 D. Dima and Hares

    dp[i][0]表示i号兔子先于i-1号兔子喂食,dp[i][1]反过来. 倒着DP D. Dima and Hares time limit per test 2 seconds memory li ...

  2. Codeforces Round #167 (Div. 1) C. Dima and Horses(BFS+贪心)

    题目大意 有 n(1≤n≤3*105) 匹马,每条马都有几个敌人(不超过 3 个),现在要求把这些马分成两部分(允许一部分中没有一条马),使得对于每条马,和它在同一部分中的敌人的数量不超过1个 给出了 ...

  3. codeforce 272B Dima and Sequence

    B. Dima and Sequence Dima got into number sequences. Now he's got sequence a1, a2, ..., an, consisti ...

  4. 巴萨队徽_巴塞罗那选择Linux,Apple的Lisa OS开源,更多新闻

    巴萨队徽 在本期开放源代码新闻摘要中,我们将介绍巴塞罗那引导Microsoft,开放源代码经典操作系统,Nextcloud聊天等等. 2018年1月7日至20日的开源新闻摘要 巴塞罗那市放弃使用Lin ...

  5. Codeforces - 272C Dima and Staircase(思维)

    题目链接---- Dima's got a staircase that consists of n stairs. The first stair is at height a1, the seco ...

  6. CodeForces - 272C Dima and Staircase (线段树区间更新)

    题意: 见以下样例,给出 5 个区间,每个区间的高度已知.一共 4 次操作.每次操作都是从最左边开始向下垒一个宽为 w 高为h 的木块,过程见下图. 问每次垒木块的高度是多少? Input 5 1 2 ...

  7. CODEFORCES 272C Dima and Staircase 细节理解题+简单技巧

    传送门:http://codeforces.com/problemset/problem/272/C C. Dima and Staircase time limit per test 2 secon ...

  8. Lisa随手记 1.7 发布

    版本:1.7 CSDN发布日期:2014年10月26日 应用简介 Lisa随手记是一款简单.易用.免费.无广告的移动记事本软件,具有以下特点: * 点开应用即可输入和显示,记录首页显示一目了然,能够快 ...

  9. Lisa随手记 1.7 帮助

     Lisa随手记,想记就记,随时随地 更新提示 1. UI简化,去掉了信息提示栏,提示信息会在编辑框中显示 2. 可以长按记录将其拖拽至编辑框进行修改 3. 向右滑动删除记录后,记录不会立即消失, ...

  10. 廖雪峰——练习 请把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字。输入:['adam', 'LISA', 'barT'],输出:['Adam', 'Lisa', 'Bart']。

    请把用户输入的不规范的英文名字,变为首字母大写,其他小写的规范名字.输入:['adam', 'LISA', 'barT'],输出:['Adam', 'Lisa', 'Bart']. 之前在网上找这个题 ...

最新文章

  1. 2021年大数据Kafka(二):❤️Kafka特点总结和架构❤️
  2. 一个模型处理多个任务
  3. mysql从零开始自增id_MySQL从零开始 7-表约束之主键,自增长,唯一键
  4. LeetCode OJ - Candy
  5. 趣文:如果编程语言是车
  6. qt显示rgba8888 如何改 frame_Qt开源作品17-IP地址输入控件
  7. 容器编排技术 -- Kubernetes kubectl edit 命令详解
  8. django 自定义标签
  9. 小语种nlp文本预处理——数据清洗
  10. AI量化交易(一)——量化交易简介
  11. 金融行业网络安全等级保护测评指南
  12. 如何将mov格式转换成mp4并且不改变分辨率
  13. 网线水晶头接法详细图文教程
  14. numpy选取矩阵数据的子矩阵
  15. tplink android管理软件,tplink路由器app下载
  16. 干货 | 以太坊的工作原理
  17. 北航2022软件工程第三次作业——结对编程(最长英语单词链)
  18. new Data()、set Data()、get Data()方法、时间戳转换
  19. 浅谈如何fltk项目编译和实现显示中文
  20. SpringBoot入门教程 Lombok使用注意事项

热门文章

  1. 将活跃天数转化为等级,输入等级查询活跃天数
  2. python登录qq定时发消息_python自动发送qq消息
  3. 7大不跳槽就会死的理由!
  4. 面试题:为什么说 Mybatis 是半自动ORM 映射工具?它与全自动的区别在哪里?
  5. 磁盘一把锁一个感叹号_Win10系统中如何解决磁盘图标上出现感叹号的情况
  6. 32位和64位CPU操作系统的区别
  7. P4556 [Vani有约会]雨天的尾巴(线段树合并)
  8. IMU惯导相关开源项目整理
  9. 无线基础知识学习(一)
  10. PHP用什么标签方便,PHP_用途相似的标签:acronym与abbr,有的时候为了方便传阅或者记 - phpStudy...